mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
A node killed while admin_importChain was accepting a round could not start its C-Chain again: "required historical state unavailable (reexec=2)". The import wrote the acceptor tip for the whole round first and then committed the round's tries one block at a time, so a kill in between left a tip on disk above the accepted pointer, naming blocks whose state was never written. reprocessState re-executes from the acceptor tip, which it takes to be at or below the block it recovers, and searches back from there only 2x the commit interval for a state to start from. The import now accepts each block the way the acceptor does, through the one acceptDurably both call: tip, then trie, a block at a time. And reprocessState moves an acceptor tip that is above the accepted block back to it, which is what recovers a database an earlier release left that way. TestImportArchive_KilledAnywhereRestarts kills an import at every write it makes, reopens from the accepted pointer the VM would read, resumes, and restarts once more. On the previous code, at commit interval 1, the kill after write 11 of 48 does not start again. Refs #152 Co-authored-by: Hanzo Dev <[email protected]>