Repository navigation
fix: stop retrying a chunk the server cannot verify - #17
Merged
Merged
Conversation
When a header chunk fails verification above the checkpoint range, the
interface falls back to a single header request and then asks for the same
chunk again, forever. A server with one unusable header therefore pins the
client in a loop:
verify_chunk from height 4501728 failed: InvalidHeader('post-activation block height cannot use legacy PoW serialization')
requesting chunk from height 4501728
requesting block header 4501728 in mode catchup
requesting chunk from height 4501728
...
The interface never becomes ready, so the wallet reports itself as not
connected while it hammers the same request about once a second, and nothing
in the UI says why.
Give up on the server after the same chunk has failed MAX_UNVERIFIABLE_CHUNK_TRIES
times, with a message naming the height. A server that cannot produce a
verifiable chunk will not start doing so on the next attempt, and a visible
failure lets the client move to another server and the operator see which
block is at fault.
Merged
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.
Symptom
A wallet connected to a server with a single unusable header never finishes header catch-up, so the interface is never marked ready and the GUI shows "not connected" with no stated reason. In the log, roughly once a second, forever:
Observed against a real server whose header database returns 120 zero bytes for height 4502646, inside the chunk starting at 4501728.
Cause
In
sync_until(), a chunk that fails to connect above the checkpoint range falls through tostep()and then requests the same chunk again. Nothing counts the repetition, and verification failure is not transient: the same bytes fail the same way next time.Change
Track consecutive failures for the same chunk height and raise
GracefulDisconnectafterMAX_UNVERIFIABLE_CHUNK_TRIES(3), naming the height. The client can then move to another server, and the operator can see exactly which chunk is at fault. Behaviour below the checkpoint range is unchanged, and a chunk failure that is followed by progress still resets the counter.Verification
Against the live server that exhibits the fault, with a headless
Network:requesting chunk from height 4501728repeats indefinitely, no disconnect, local height frozendisconnecting due to GracefulDisconnect('server cannot serve a verifiable header chunk at height 4501728')test_interface.py,test_blockchain.py,test_core_safety_policy.py,test_ravencoin_backend.py: 94 passed, 35 subtests.Note
This makes the failure visible and lets the client fail over. It does not make such a server usable: the underlying fault is a hole in that server's header database, which has to be repaired server side.