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

internal: fast exit if getTxReceipt notfound #27712

Merged
merged 1 commit into from Jul 13, 2023

Conversation

jsvisa
Copy link
Contributor

@jsvisa jsvisa commented Jul 13, 2023

In the eth backend, the GetTransaction will always return nil error, but the tx maybe is null, so we don't have to continue the following logic if tx notfound

func (b *EthAPIBackend) GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error) {
tx, blockHash, blockNumber, index := rawdb.ReadTransaction(b.eth.ChainDb(), txHash)
return tx, blockHash, blockNumber, index, nil
}

@jsvisa jsvisa changed the title internal/ethapi: fast exit if getTxReceipt notfound internal: fast exit if getTxReceipt notfound Jul 13, 2023
Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM
For other reviewers: the tx being nil might indicate that it is a transaction in the pool, but for obtaining the receipt, digging the tx out from the pool doesn't solve it, so returning nil here seems fine

@holiman holiman added this to the 1.12.1 milestone Jul 13, 2023
@holiman holiman merged commit 10a136a into ethereum:master Jul 13, 2023
2 checks passed
MoonShiesty pushed a commit to MoonShiesty/go-ethereum that referenced this pull request Aug 30, 2023
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants