Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node: remove unused node GetTransaction and ListTxns methods #5983

Merged
merged 2 commits into from
Apr 26, 2024

Conversation

cce
Copy link
Contributor

@cce cce commented Apr 23, 2024

Summary

While reviewing #5757 I noticed that there are two AlgorandFullNode methods that are no longer called since #4847 when the v1 API was removed.

Test Plan

Existing tests should pass.

@jannotti
Copy link
Contributor

This also seems to be the only place mockNode.usertxns is used. Perhaps you can pull the thread a bit more and delete more stuff.

Copy link
Contributor

@jannotti jannotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can all of these go from mockNode?

func (m *mockNode) Start() {}
func (m *mockNode) ListeningAddress() (string, bool) {
func (m *mockNode) Stop() {}
func (m *mockNode) IsArchival() bool {
func (m *mockNode) OnNewBlock(block bookkeeping.Block, delta ledgercore.StateDelta) {}
func (m *mockNode) Uint64() uint64 {

@jannotti
Copy link
Contributor

And this means AddressTxns can go away from LedgerForAPI and from data.Ledger, I think.

@jannotti
Copy link
Contributor

And I don't think:

func (tx Transaction) MatchAddress(addr basics.Address, spec SpecialAddresses) bool {

will need to take SpecialAddresses anymore.

@cce
Copy link
Contributor Author

cce commented Apr 24, 2024

AddressTxns is still used by the REST API (for fetching the latest state proof txn in a given round range)

Copy link

codecov bot commented Apr 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.05%. Comparing base (c07f2d5) to head (6aae672).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5983   +/-   ##
=======================================
  Coverage   56.05%   56.05%           
=======================================
  Files         481      481           
  Lines       67679    67615   -64     
=======================================
- Hits        37936    37902   -34     
+ Misses      27177    27141   -36     
- Partials     2566     2572    +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jannotti
Copy link
Contributor

jannotti commented Apr 24, 2024

AddressTxns is still used by the REST API (for fetching the latest state proof txn in a given round range)

I missed that. It's serious overkill though. We're just looking for txns from the stateproof sender. The heart of AddressTxns does this:

	var res []transactions.SignedTxnWithAD
	payset, err := blk.DecodePaysetFlat()
	if err != nil {
		return nil, err
	}
	for _, tx := range payset {
		if tx.Txn.MatchAddress(id, spec) {
			res = append(res, tx)
		}
	}

But there's really no reason to decode all of the txns. AddrTxns could become TxnsFrom(sender basics.Address) since we only need that case now, and we can check sender without decoding the stib or using MatchAddress. (MatchAddress is its own weird overkill - which a slice of addresses is built up, just to then check if id is in it)

I'm perfectly happy to approve as is, though.

@cce cce merged commit adf39d2 into algorand:master Apr 26, 2024
17 of 18 checks passed
@cce cce deleted the unused-node-v1-api branch April 26, 2024 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants