[1.2.2] P2P: Reset sync on rejected block #1726
Merged
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.
Reverts #1676. A recent test failure #1716 demonstrates the need for the reset. The test failed because it timed out waiting for LIB to advance. The node did actually advance LIB but not in the expected 30 second timeout. The issue was that an unlinkable block at transition from LIB catchup to HEAD catchup didn't reset sync and therefore the node didn't know it needed to continue syncing. The handshake was not sufficient because the other node thought it had caught up. This was exasperated by the node syncing was in IRREVERSIBLE mode. It is possible that we could live with only resetting when running in IRREVERSIBLE mode. However, I think the safest and most direct approach is to go back to resetting the sync, but guard against resetting the sync when know we have already reset the sync. Therefore, fixing #1673 in a different way.
Resolves #1716
Resolves #1673