mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
parent
1f05c3e5fd
commit
a41a92978d
1 changed files with 8 additions and 0 deletions
|
|
@ -484,6 +484,14 @@ func (t *Trie) delete(n node, prefix, key []byte) (bool, node, error) {
|
||||||
n.flags = t.newFlag()
|
n.flags = t.newFlag()
|
||||||
n.Children[key[0]] = nn
|
n.Children[key[0]] = nn
|
||||||
|
|
||||||
|
// Because n is a full node, it must've contained at least two children
|
||||||
|
// before the delete operation. If the new child value is non-nil, n still
|
||||||
|
// has at least two children after the deletion, and cannot be reduced to
|
||||||
|
// a short node.
|
||||||
|
if nn != nil {
|
||||||
|
return true, n, nil
|
||||||
|
}
|
||||||
|
// Reduction:
|
||||||
// Check how many non-nil entries are left after deleting and
|
// Check how many non-nil entries are left after deleting and
|
||||||
// reduce the full Node to a short Node if only one entry is
|
// reduce the full Node to a short Node if only one entry is
|
||||||
// left. Since n must've contained at least two children
|
// left. Since n must've contained at least two children
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue