[DRAFT]fix: lastBlockList should be set at the end#1923
[DRAFT]fix: lastBlockList should be set at the end#1923thomas-nguy wants to merge 3 commits intocrypto-org-chain:release/v1.6.xfrom
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 |
There was a problem hiding this comment.
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? |
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details: |
👮🏻👮🏻👮🏻 !!!! 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! :)