-
Notifications
You must be signed in to change notification settings - Fork 20.9k
eth/fetcher: Remove unnecessary error check to satisfy static analysis #23739
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
Conversation
c641156
to
4db8f1c
Compare
@@ -277,29 +277,27 @@ func (f *TxFetcher) Enqueue(peer string, txs []*types.Transaction, direct bool) | |||
) | |||
errs := f.addTxs(txs) | |||
for i, err := range errs { | |||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if err != nil
was bothering the nilness analysis check and is safe to remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Change doesn't alter the code logic here. Although tbh, I'm slightly confused about the issue this claims to solve. The err
can definitely be non-nil. So I'm wondering if maybe the nilness analysis check is complaining erroneously here.
Sorry, I didn't notice that you had made this PR, so I made one myself too |
While we're fixing the code, it would be good to remove explicit error checks, and use |
@holiman I've done this now. Please take a look! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* eth/fetcher: fix nilness check ethereum#23738 * eth/fetcher: Use errors.Is. PR feedback from @holiman.
* eth/fetcher: fix nilness check ethereum#23738 * eth/fetcher: Use errors.Is. PR feedback from @holiman.
Fixes #23738. See #23738 for more context on the nilness analysis check issue.