mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-13 18:31:35 +00:00
Empty.Insert and Empty.InsertValuesAtStem construct a fresh StemNode with mustRecompute=true but left the new `dirty` field at its zero value. With the skip-clean CollectNodes optimization enabled, the resulting stem was treated as already-persisted and never flushed to disk. A parent InternalNode's blob would be written referencing a hash for which no blob existed, causing "missing trie node" errors on subsequent reads. This is the path hit whenever a key is inserted into an Empty subtree — the common case on the first insert, and frequently thereafter on splits that leave one side Empty. A long-running deployment surfaced the bug after ~15 hours of random ERC20 writes. Add `dirty: true` to both struct literals, and add regression guards TestEmptyInsertMarksDirty / TestEmptyInsertValuesAtStemMarksDirty that assert the returned stem is dirty. |
||
|---|---|---|
| .. | ||
| binary_node.go | ||
| binary_node_test.go | ||
| empty.go | ||
| empty_test.go | ||
| hashed_node.go | ||
| hashed_node_test.go | ||
| hasher.go | ||
| internal_node.go | ||
| internal_node_test.go | ||
| iterator.go | ||
| iterator_test.go | ||
| key_encoding.go | ||
| stem_node.go | ||
| stem_node_test.go | ||
| trie.go | ||
| trie_test.go | ||