From d4076b2b1fcfecf2b1e164756bd5b6149bd9c6f3 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Tue, 4 Feb 2020 12:39:30 +0100 Subject: [PATCH] trie: rename unhashedCount/unhashed --- trie/trie.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trie/trie.go b/trie/trie.go index 2e6f5c4ea7..78e2eff534 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -51,7 +51,7 @@ type Trie struct { // 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 - unhashedCount int + unhashed int } // newFlag returns the cache flag value for a newly created node. @@ -167,7 +167,7 @@ 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.unhashed++ k := keybytesToHex(key) if len(value) != 0 { _, n, err := t.insert(t.root, nil, k, valueNode(value)) @@ -264,7 +264,7 @@ func (t *Trie) Delete(key []byte) { // TryDelete removes any existing value for key from the trie. // If a node was not found in the database, a MissingNodeError is returned. func (t *Trie) TryDelete(key []byte) error { - t.unhashedCount++ + t.unhashed++ k := keybytesToHex(key) _, n, err := t.delete(t.root, nil, k) if err != nil { @@ -467,9 +467,9 @@ func (t *Trie) hashRoot(db *Database) (node, node, error) { return hashNode(emptyRoot.Bytes()), nil, nil } // If the number of changes is below 100, we let one thread handle it - h := newHasher(t.unhashedCount >= 100) + h := newHasher(t.unhashed >= 100) defer returnHasherToPool(h) hashed, cached := h.hash(t.root, true) - t.unhashedCount = 0 + t.unhashed = 0 return hashed, cached, nil }