expose NodeIterator

This commit is contained in:
Roy Crihfield 2023-04-10 16:18:26 +08:00
parent a5a95c2a9f
commit 3ddb592d6b
2 changed files with 7 additions and 1 deletions

View File

@ -44,7 +44,7 @@ type Trie interface {
TryGet(key []byte) ([]byte, error)
TryGetAccount(key []byte) (*types.StateAccount, error)
Hash() common.Hash
// NodeIterator(startKey []byte) trie.NodeIterator
NodeIterator(startKey []byte) trie.NodeIterator
Prove(key []byte, fromLevel uint, proofDb ethdb.KeyValueWriter) error
}

View File

@ -101,6 +101,12 @@ func (t *StateTrie) Hash() common.Hash {
return t.trie.Hash()
}
// NodeIterator returns an iterator that returns nodes of the underlying trie. Iteration
// starts at the key after the given start key.
func (t *StateTrie) NodeIterator(start []byte) NodeIterator {
return t.trie.NodeIterator(start)
}
// hashKey returns the hash of key as an ephemeral buffer.
// The caller must not hold onto the return value because it will become
// invalid on the next call to hashKey or secKey.