trie: fix typo

This commit is contained in:
Haoran Wang 2024-04-21 13:56:08 +08:00
parent b92dede7cc
commit 61dc20152f
2 changed files with 2 additions and 2 deletions

View file

@ -23,7 +23,7 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
) )
// ErrCommitted is returned when a already committed trie is requested for usage. // ErrCommitted is returned when an already committed trie is requested for usage.
// The potential usages can be `Get`, `Update`, `Delete`, `NodeIterator`, `Prove` // The potential usages can be `Get`, `Update`, `Delete`, `NodeIterator`, `Prove`
// and so on. // and so on.
var ErrCommitted = errors.New("trie is already committed") var ErrCommitted = errors.New("trie is already committed")

View file

@ -372,7 +372,7 @@ func unset(parent node, child node, key []byte, pos int, removeLeft bool) error
return unset(cld, cld.Children[key[pos]], key, pos+1, removeLeft) return unset(cld, cld.Children[key[pos]], key, pos+1, removeLeft)
case *shortNode: case *shortNode:
if len(key[pos:]) < len(cld.Key) || !bytes.Equal(cld.Key, key[pos:pos+len(cld.Key)]) { if len(key[pos:]) < len(cld.Key) || !bytes.Equal(cld.Key, key[pos:pos+len(cld.Key)]) {
// Find the fork point, it's an non-existent branch. // Find the fork point, it's a non-existent branch.
if removeLeft { if removeLeft {
if bytes.Compare(cld.Key, key[pos:]) < 0 { if bytes.Compare(cld.Key, key[pos:]) < 0 {
// The key of fork shortnode is less than the path // The key of fork shortnode is less than the path