mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-12 09:51:36 +00:00
The bintrie node iterator previously discarded its `start` parameter, forcing every iteration to begin at the root. This makes resumable generators (snapshot/flat-state population) impossible — any interruption restarts from scratch. Implement seek(start []byte) by walking down the trie following start's bit path, building the iterator stack as we go. When the chosen path dead-ends (Empty, missing child, or a stem strictly less than start), backtrack through the existing stack to find the next in-order subtree and descend to its leftmost leaf. Also wire BinaryTrie.NodeIterator(startKey) to actually pass startKey through (was hardcoded to nil). Tests cover: empty start (no-op), exact key match, between-keys, into empty subtree, past end, within-stem offsets, resume simulation, and deep tree. |
||
|---|---|---|
| .. | ||
| 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 | ||