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

core: add a comment for error return of nil #30811

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

wangjingcun
Copy link
Contributor

@wangjingcun wangjingcun commented Nov 26, 2024

According to the comments and code logic, the err here should be handled by the upper layer GetTransaction

Add a comment for error return of nil

@MariusVanDerWijden
Copy link
Member

I think the err should not be passed up.
GetTransactionLookup should return an error if a transaction can not be determined to be found or not.
Doing so allows callers to periodically re-request these transaction if needed.
The only cases that bc.TxIndexProgress() errors is if the transaction indexing is not started or stopped already.
In both cases the transaction will not be found in the future, so we correctly return nil imo.
We could add a comment for this though

@wangjingcun
Copy link
Contributor Author

I think the err should not be passed up. GetTransactionLookup should return an error if a transaction can not be determined to be found or not. Doing so allows callers to periodically re-request these transaction if needed. The only cases that bc.TxIndexProgress() errors is if the transaction indexing is not started or stopped already. In both cases the transaction will not be found in the future, so we correctly return nil imo. We could add a comment for this though

Thank you for your review. Do you have any good suggestions for adding to the review? I'd be happy to add them.

@rjl493456442 rjl493456442 self-assigned this Nov 26, 2024
@wangjingcun wangjingcun changed the title core: pass the err that is ignored to the upper method core: add a comment for error return of nil Nov 26, 2024
Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

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

SGTM

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

@holiman holiman added this to the 1.14.13 milestone Nov 27, 2024
@holiman holiman merged commit e0deac7 into ethereum:master Nov 27, 2024
1 of 2 checks passed
@fjl fjl modified the milestones: 1.14.13, 1.15.0 Jan 23, 2025
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.

5 participants