mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-20 13:44:31 +00:00
When enabling trienode history (--history.trienode=0) on a node that already has state at block N, repairHistory() returns a fatal error: "gap between state [#N] and trienode history [#0]" This happens because the newly created trienode freezer has 0 entries while state is at block N. The gap check on line 427 treats this as a data corruption error, but the function's own comments document that it should "detect and resolve such gaps" for the optional trienode history. Fix by detecting the newly-enabled case (empty freezer + non-zero stateID) and skipping both the gap check and the head truncation. An empty freezer with head=0 would also fail truncateFromHead because ohead(0) < nhead(stateID) is outside the valid range. The trienode history will begin accumulating naturally from the current state forward, which is the expected behavior documented in the v1.17.0 release notes. Fixes ethereum/go-ethereum#33907 |
||
|---|---|---|
| .. | ||
| database | ||
| hashdb | ||
| pathdb | ||
| database.go | ||
| history.go | ||
| preimages.go | ||
| preimages_test.go | ||
| states.go | ||