-
Notifications
You must be signed in to change notification settings - Fork 274
fix: lastBlockList should be set at the end #1923
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
base: release/v1.6.x
Are you sure you want to change the base?
fix: lastBlockList should be set at the end #1923
Conversation
This comment has been minimized.
This comment has been minimized.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
JayT106
left a comment
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
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.
I believe the original place to update the h.lastBlockList is actually ok - more precisely: it's not the best place...but it's not posing any problems.
If we put it at the end only after block list is successfully updated:
- if the new block list is empty,
h.lastBlockListnever get updated. This is minor as it will early return immediately. - There're a few reasons blocklist may fail to be decrypted but they are not going to be recovered in next
SetBlockListcall.- Node identity is incorrect. Node identity cannot be updated in run-time, only via restart. So the decrypt would always fail in
SetBlockList. - Blocklist is corrupted, either encryption error or invalid content. Still
SetBlockListwill continue to fail until another blocklist update.
- Node identity is incorrect. Node identity cannot be updated in run-time, only via restart. So the decrypt would always fail in
In terms of code readability and cleanliness, moving h.lastBlockList updates to any place returning nil (including inside the empty check) is appropriate. But practically it is not creating any issues if I am not mistaken.
Currently if the blocklist cannot be decrypted, it will fail only at the next block but from the next block, the error will be ignored. Is it your expected behavior? |
👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻
PR Checklist:
make)make test)go fmt)golangci-lint run)go list -json -m all | nancy sleuth)Thank you for your code, it's appreciated! :)