Repository navigation
Conversation
Restore terminal chain inventory checks against the HELLO head and requested summary, and reject replies below recent block announcements received before the request. Resume synchronization with a random eligible peer through the existing fetch worker after a syncing peer disconnects. Cover source selection, retries, and recovery of previously discarded blocks.
Keep terminal chain inventory validation and its tests focused in this PR. Restore SyncService and SyncServiceTest to release_v4.8.3 so proactive source recovery can be reviewed separately.
Rename advertisedNum to maxAdvInvNum and adjust the inventory validation comment and stream formatting without changing validation behavior.
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.
What does this PR do?
Reject terminal (
remain_num=0) chain inventory replies whose last block height is below the peer's HELLO head or a recent BLOCK announcement received before the sync request. Also reject multi-block terminal replies whose final block already appears in the requested summary. Disconnect inconsistent replies withSYNC_FAIL.Why are these changes required?
A peer can announce and deliver newer blocks while answering a sync request with only a block already known locally. Accepting that reply marks the connection synchronized without identifying the missing blocks. The validation prevents these contradictory replies from being accepted.
This PR has been tested by:
ChainInventoryMsgHandlerTest,InventoryMsgHandlerTest, andSyncServiceTest../gradlew clean build -x test../gradlew :framework:checkstyleMain :framework:checkstyleTest :plugins:checkstyleMain.bash .github/scripts/check_math_usage.shandgit diff --check.Follow up
Evaluate proactive synchronization recovery separately.
Extra details
Fork rollbacks can temporarily contradict a previous handshake or summary snapshot. Use a synchronization failure so the peer can reconnect with a fresh handshake.