Skip to content

Conversation

@whankinsiv
Copy link
Collaborator

Description

Refactors chain_store to stop overwriting blocks when clear-on-start is false. After the first full sync, subsequent syncs run 2-3x faster because persistence now resumes from last_stored_block + 1.

To prevent corrupt state when switching networks, this adds handle_first_block, which compares the first block received from cardano.block.available with the stored block and returns an error if the block bodies differ.

Related Issue(s)

Speeds up development and testing for anything that depends on chain_store. Implemented primarily to accelerate testing of the /addresses/{address}/utxos endpoint in #335.

How was this tested?

  • Verified persistence resumes at last_stored_block + 1
  • Observed the 2-3x speedup on repeated runs.

Checklist

  • My code builds and passes local tests
  • I added/updated tests for my changes, where applicable
  • I updated documentation (if applicable)
  • CI is green for this PR

Impact / Side effects

Major sync performance improvement (2-3x) after initial sync. Behavior unchanged when clear-on-start = true.

Reviewer notes / Areas to focus

All logic changes are fairly straight forward.

Signed-off-by: William Hankins <william@sundae.fi>
@whankinsiv whankinsiv requested a review from alexwoods November 14, 2025 20:47
@whankinsiv whankinsiv merged commit 9886932 into main Nov 14, 2025
2 checks passed
@whankinsiv whankinsiv deleted the whankinsiv/stop-overwriting-stored-blocks branch November 14, 2025 23:42
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.

3 participants