Skip to content

fix: stop retrying a chunk the server cannot verify - #17

Merged
ALENOC merged 1 commit into
masterfrom
fix/stop-retrying-unverifiable-chunk
Sep 19, 2026
Merged

ALENOC merged 1 commit into
masterfrom
fix/stop-retrying-unverifiable-chunk

Conversation

@ALENOC

@ALENOC ALENOC commented Sep 19, 2026

Copy link
Copy Markdown
Owner

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:

blockchain.Blockchain | verify_chunk from height 4501728 failed: InvalidHeader('post-activation block height cannot use legacy PoW serialization')
interface | requesting chunk from height 4501728
interface | requesting block header 4501728 in mode catchup
interface | requesting chunk from height 4501728

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 to step() 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 GracefulDisconnect after MAX_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:

  • before: requesting chunk from height 4501728 repeats indefinitely, no disconnect, local height frozen
  • after: disconnecting 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.

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.
@ALENOC ALENOC mentioned this pull request Sep 19, 2026
@ALENOC
ALENOC merged commit d018109 into master Sep 19, 2026
4 checks passed
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