trie: use keyvalue reader for non-mutating methods (#24221)

This commit is contained in:
Darioush Jalali 2022-01-11 14:36:48 -06:00 committed by GitHub
parent 52448e9585
commit 2c58e6b62d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,7 +115,7 @@ type NodeIterator interface {
// Before adding a similar mechanism to any other place in Geth, consider
// making trie.Database an interface and wrapping at that level. It's a huge
// refactor, but it could be worth it if another occurrence arises.
AddResolver(ethdb.KeyValueStore)
AddResolver(ethdb.KeyValueReader)
}
// nodeIteratorState represents the iteration state at one particular node of the
@ -134,7 +134,7 @@ type nodeIterator struct {
path []byte // Path to the current node
err error // Failure set in case of an internal error in the iterator
resolver ethdb.KeyValueStore // Optional intermediate resolver above the disk layer
resolver ethdb.KeyValueReader // Optional intermediate resolver above the disk layer
}
// errIteratorEnd is stored in nodeIterator.err when iteration is done.
@ -159,7 +159,7 @@ func newNodeIterator(trie *Trie, start []byte) NodeIterator {
return it
}
func (it *nodeIterator) AddResolver(resolver ethdb.KeyValueStore) {
func (it *nodeIterator) AddResolver(resolver ethdb.KeyValueReader) {
it.resolver = resolver
}
@ -549,7 +549,7 @@ func (it *differenceIterator) Path() []byte {
return it.b.Path()
}
func (it *differenceIterator) AddResolver(resolver ethdb.KeyValueStore) {
func (it *differenceIterator) AddResolver(resolver ethdb.KeyValueReader) {
panic("not implemented")
}
@ -660,7 +660,7 @@ func (it *unionIterator) Path() []byte {
return (*it.items)[0].Path()
}
func (it *unionIterator) AddResolver(resolver ethdb.KeyValueStore) {
func (it *unionIterator) AddResolver(resolver ethdb.KeyValueReader) {
panic("not implemented")
}