Update stale block time after resetting connections#275
Merged
rustaceanrob merged 1 commit intomasterfrom Jan 20, 2025
Merged
Conversation
nyonson
reviewed
Jan 18, 2025
If a block is considered stale, the `advance_state` function will reset connections with all peers. To reset the "staleness" of a block, the `LastBlockMonitor::update` function must be called. Currently that is done upon receiving new block headers, but no headers will ever be sent, as `advance_state` disconnects the peers before they can send them once a block is considered stale. Here we patch this to reset the "staleness" of a block after disconnecting from all peers.
09d8490 to
fb96592
Compare
Collaborator
Author
|
This patch resolved an instance of a stale block on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a block is considered stale, the
advance_statefunction will reset connections with all peers. To reset the "staleness" of a block, theLastBlockMonitor::updatefunction must be called. Currently that is done upon receiving new block headers, but no headers will ever be sent, asadvance_statedisconnects the peers before they can send them. That causes a loop that makes no progress. Here we patch this to reset the "staleness" of a block after disconnecting from all peers.For context, the
LastBlockMonitoris used to prevent a block withholding attack, where all connected peers refuse to advertise new blocks to us. After 30 minutes if there is no block found, we open new connections to see if there was a block being withheld. @nyonson