mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
admin_importChain and --import-chain-data validate blocks with InsertChain and then move the accepted tip with SetLastAcceptedBlockDirect. Neither step does what the acceptor does for a block consensus accepts: index its transactions and hand its trie to the state manager. An archive node therefore committed only the roots the import force-committed at round ends and indexed only each round's last block. After a restart every other height's state was a missing trie node, eth_getTransactionByHash found one transaction per round, and with commit-interval 1 the startup head repair could not re-execute the tip from the height before it, so the C-Chain did not start. AcceptImported does the acceptor's durable work for each inserted block, in order, through acceptState, which the acceptor now calls too. TestImportArchive_HistorySurvivesRestart imports in rounds shorter than the chain, reopens it on the same database, and checks every height's state and every transaction's lookup. On the previous code it fails at height 1, and with commit-interval 1 the chain does not reopen. A database an earlier release imported keeps the gaps; only a fresh import under this one fills them. Fixes #152 Co-authored-by: Hanzo Dev <[email protected]>