From f2f4b3a4abe35522f3d40772c32f45c3d2d321da Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Tue, 10 Jun 2025 15:08:10 +0800 Subject: [PATCH] trie: more linters #24783 --- trie/proof.go | 18 ++++++++++-------- trie/utils.go | 4 ++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/trie/proof.go b/trie/proof.go index 7705e356c07..881f256decf 100644 --- a/trie/proof.go +++ b/trie/proof.go @@ -367,11 +367,12 @@ func unset(parent node, child node, key []byte, pos int, removeLeft bool) error // branch. The parent must be a fullnode. fn := parent.(*fullNode) fn.Children[key[pos-1]] = nil - } else { - // The key of fork shortnode is greater than the - // path(it doesn't belong to the range), keep - // it with the cached hash available. } + //else { + // The key of fork shortnode is greater than the + // path(it doesn't belong to the range), keep + // it with the cached hash available. + //} } else { if bytes.Compare(cld.Key, key[pos:]) > 0 { // The key of fork shortnode is greater than the @@ -379,11 +380,12 @@ func unset(parent node, child node, key []byte, pos int, removeLeft bool) error // branch. The parent must be a fullnode. fn := parent.(*fullNode) fn.Children[key[pos-1]] = nil - } else { - // The key of fork shortnode is less than the - // path(it doesn't belong to the range), keep - // it with the cached hash available. } + //else { + // The key of fork shortnode is less than the + // path(it doesn't belong to the range), keep + // it with the cached hash available. + //} } return nil } diff --git a/trie/utils.go b/trie/utils.go index fe7f6e52f9e..7e26915041e 100644 --- a/trie/utils.go +++ b/trie/utils.go @@ -50,6 +50,7 @@ func newTracer() *tracer { } } +/* // onRead tracks the newly loaded trie node and caches the rlp-encoded blob internally. // Don't change the value outside of function since it's not deep-copied. func (t *tracer) onRead(key []byte, val []byte) { @@ -59,6 +60,7 @@ func (t *tracer) onRead(key []byte, val []byte) { } t.origin[string(key)] = val } +*/ // onInsert tracks the newly inserted trie node. If it's already in the deletion set // (resurrected node), then just wipe it from the deletion set as the "untouched". @@ -115,6 +117,7 @@ func (t *tracer) deleteList() [][]byte { return ret } +/* // getPrev returns the cached original value of the specified node. func (t *tracer) getPrev(key []byte) []byte { // Don't panic on uninitialized tracer, it's possible in testing. @@ -123,6 +126,7 @@ func (t *tracer) getPrev(key []byte) []byte { } return t.origin[string(key)] } +*/ // reset clears the content tracked by tracer. func (t *tracer) reset() {