cmd, core, eth, trie: get rid of trie cache generations (#19262)
* cmd, core, eth, trie: get rid of trie cache generations * core, trie: get rid of remainder of cache gen boilerplate
This commit is contained in:
@ -51,7 +51,7 @@ type SecureTrie struct {
|
||||
// Loaded nodes are kept around until their 'cache generation' expires.
|
||||
// A new cache generation is created by each call to Commit.
|
||||
// cachelimit sets the number of past cache generations to keep.
|
||||
func NewSecure(root common.Hash, db *Database, cachelimit uint16) (*SecureTrie, error) {
|
||||
func NewSecure(root common.Hash, db *Database) (*SecureTrie, error) {
|
||||
if db == nil {
|
||||
panic("trie.NewSecure called without a database")
|
||||
}
|
||||
@ -59,7 +59,6 @@ func NewSecure(root common.Hash, db *Database, cachelimit uint16) (*SecureTrie,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
trie.SetCacheLimit(cachelimit)
|
||||
return &SecureTrie{trie: *trie}, nil
|
||||
}
|
||||
|
||||
@ -161,12 +160,6 @@ func (t *SecureTrie) Hash() common.Hash {
|
||||
return t.trie.Hash()
|
||||
}
|
||||
|
||||
// Root returns the root hash of SecureTrie.
|
||||
// Deprecated: use Hash instead.
|
||||
func (t *SecureTrie) Root() []byte {
|
||||
return t.trie.Root()
|
||||
}
|
||||
|
||||
// Copy returns a copy of SecureTrie.
|
||||
func (t *SecureTrie) Copy() *SecureTrie {
|
||||
cpy := *t
|
||||
@ -183,7 +176,7 @@ func (t *SecureTrie) NodeIterator(start []byte) NodeIterator {
|
||||
// The caller must not hold onto the return value because it will become
|
||||
// invalid on the next call to hashKey or secKey.
|
||||
func (t *SecureTrie) hashKey(key []byte) []byte {
|
||||
h := newHasher(0, 0, nil)
|
||||
h := newHasher(nil)
|
||||
h.sha.Reset()
|
||||
h.sha.Write(key)
|
||||
buf := h.sha.Sum(t.hashKeyBuf[:0])
|
||||
|
Reference in New Issue
Block a user