diff --git a/trie/trie.go b/trie/trie.go index fdf8414052..2e6f5c4ea7 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -48,10 +48,6 @@ type LeafCallback func(leaf []byte, parent common.Hash) error type Trie struct { db *Database root node - // Keep a track of the number of leafs to commit. This counter is - // update for inserts and deletions of leafs, but does not accurately track the number - // of nodes - dirtyCount int // Keep track of the number leafs which have been inserted since the last // hashing operation. This number will not directly map to the number of // actually unhashed nodes @@ -172,7 +168,6 @@ func (t *Trie) Update(key, value []byte) { // If a node was not found in the database, a MissingNodeError is returned. func (t *Trie) TryUpdate(key, value []byte) error { t.unhashedCount++ - t.dirtyCount++ k := keybytesToHex(key) if len(value) != 0 { _, n, err := t.insert(t.root, nil, k, valueNode(value)) @@ -270,7 +265,6 @@ func (t *Trie) Delete(key []byte) { // If a node was not found in the database, a MissingNodeError is returned. func (t *Trie) TryDelete(key []byte) error { t.unhashedCount++ - t.dirtyCount++ k := keybytesToHex(key) _, n, err := t.delete(t.root, nil, k) if err != nil { @@ -463,7 +457,6 @@ func (t *Trie) Commit(onleaf LeafCallback) (root common.Hash, err error) { if err != nil { return common.Hash{}, err } - t.dirtyCount = 0 t.root = newRoot return rootHash, nil }