mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-08 16:01:36 +00:00
AdvancePartialHead's backfill loop used a strictly-greater condition, so it wrote canonical-hash keys only for blocks above the pivot. Combined with the Engine API path persisting the pivot via WriteBlockWithoutState (which writes header+body but not the canonical-hash key) and InsertReceiptChain.writeLive skipping the pivot because HasBlock already returned true, the pivot block ended up without an H<num>n entry in leveldb. After the freezer advanced past finalized, startup's gap check at rawdb/database.go:279 rejected the datadir with "gap in the chain between ancients [0 - #N-1] and leveldb [#N+1 - #head]". Fix: explicitly write the canonical hash for currentHead at the start of AdvancePartialHead's backfill, covering the pivot inclusively. Also add a defensive guard in the chain-retention freezer path so that TruncateTail never prunes past lastPivotNumber. Partial-state mode relies on the pivot block as the anchor for state reconstruction; pruning its body from ancients would make a future reorg spanning the pivot unrecoverable. Ship with a regression test that asserts AdvancePartialHead writes the currentHead's canonical hash (covers the bug precondition directly), plus an idempotency check and a small post-advance sanity test. Verified end-to-end on bal-devnet-3: - Before fix: Fatal on restart - After fix: restart succeeds, BAL processing resumes within seconds, verify_partial_sync_devnet3.sh passes 16/16 checks. |
||
|---|---|---|
| .. | ||
| ancienttest | ||
| eradb | ||
| testdata | ||
| accessors_bal.go | ||
| accessors_chain.go | ||
| accessors_chain_test.go | ||
| accessors_history.go | ||
| accessors_indexes.go | ||
| accessors_indexes_test.go | ||
| accessors_metadata.go | ||
| accessors_overlay.go | ||
| accessors_snapshot.go | ||
| accessors_state.go | ||
| accessors_sync.go | ||
| accessors_trie.go | ||
| ancient_scheme.go | ||
| ancient_utils.go | ||
| chain_freezer.go | ||
| chain_iterator.go | ||
| chain_iterator_test.go | ||
| database.go | ||
| freezer.go | ||
| freezer_batch.go | ||
| freezer_memory.go | ||
| freezer_memory_test.go | ||
| freezer_meta.go | ||
| freezer_meta_test.go | ||
| freezer_resettable.go | ||
| freezer_resettable_test.go | ||
| freezer_table.go | ||
| freezer_table_test.go | ||
| freezer_test.go | ||
| freezer_utils.go | ||
| freezer_utils_test.go | ||
| freezer_utils_unix.go | ||
| freezer_utils_windows.go | ||
| key_length_iterator.go | ||
| key_length_iterator_test.go | ||
| schema.go | ||
| table.go | ||
| table_test.go | ||