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.
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
}

View file

@ -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() {