trie: more linters #24783 (#1092)

This commit is contained in:
Daniel Liu 2025-08-26 15:19:07 +08:00 committed by GitHub
parent cb338be877
commit 3d69b27ae4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 8 deletions

View file

@ -367,11 +367,12 @@ func unset(parent node, child node, key []byte, pos int, removeLeft bool) error
// branch. The parent must be a fullnode. // branch. The parent must be a fullnode.
fn := parent.(*fullNode) fn := parent.(*fullNode)
fn.Children[key[pos-1]] = nil fn.Children[key[pos-1]] = nil
} else { }
//else {
// The key of fork shortnode is greater than the // The key of fork shortnode is greater than the
// path(it doesn't belong to the range), keep // path(it doesn't belong to the range), keep
// it with the cached hash available. // it with the cached hash available.
} //}
} else { } else {
if bytes.Compare(cld.Key, key[pos:]) > 0 { if bytes.Compare(cld.Key, key[pos:]) > 0 {
// The key of fork shortnode is greater than the // 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. // branch. The parent must be a fullnode.
fn := parent.(*fullNode) fn := parent.(*fullNode)
fn.Children[key[pos-1]] = nil fn.Children[key[pos-1]] = nil
} else { }
//else {
// The key of fork shortnode is less than the // The key of fork shortnode is less than the
// path(it doesn't belong to the range), keep // path(it doesn't belong to the range), keep
// it with the cached hash available. // it with the cached hash available.
} //}
} }
return nil return nil
} }

View file

@ -50,6 +50,7 @@ func newTracer() *tracer {
} }
} }
/*
// onRead tracks the newly loaded trie node and caches the rlp-encoded blob internally. // 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. // Don't change the value outside of function since it's not deep-copied.
func (t *tracer) onRead(key []byte, val []byte) { 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 t.origin[string(key)] = val
} }
*/
// onInsert tracks the newly inserted trie node. If it's already in the deletion set // 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". // (resurrected node), then just wipe it from the deletion set as the "untouched".
@ -115,6 +117,7 @@ func (t *tracer) deleteList() [][]byte {
return ret return ret
} }
/*
// getPrev returns the cached original value of the specified node. // getPrev returns the cached original value of the specified node.
func (t *tracer) getPrev(key []byte) []byte { func (t *tracer) getPrev(key []byte) []byte {
// Don't panic on uninitialized tracer, it's possible in testing. // 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)] return t.origin[string(key)]
} }
*/
// reset clears the content tracked by tracer. // reset clears the content tracked by tracer.
func (t *tracer) reset() { func (t *tracer) reset() {