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

node: Send local block if iteration is lower #2417

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fed-franz
Copy link
Contributor

If the node receives a block with higher iteration than the local block, it sends back the local block. The peer is expected to revert and accept it, unless the block sent to us has been finalized.

This commit also refactors on_block_event to unify the handling of remote_blk.height < tip.height and remote_blk.height == tip.height. These two cases are in fact equivalent and should be treated the same.

The unification of the two cases greatly improves readability and maintenance. A bug is also fixed, due to which the node erroneously switched to OutOfSync if reverting a block lower than the tip.

If the node receives a block with higher iteration than the local
block, it sends back the local block. The peer is expected to
revert and accept it, unless the block sent to us has been
finalized.

This commit also refactors on_block_event to unify the handling
of remote_blk.height < tip.height and remote_blk.height == tip.height.
These two cases are in fact equivalent and should be treated the same.

The unification of the two cases greatly improves readability and
maintenance. A bug is also fixed, due to which  the node erroneously
switched to OutOfSync if reverting a block lower than the tip.
@fed-franz fed-franz marked this pull request as ready for review September 19, 2024 09:55
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.

1 participant