trie: reduce fullNode to valueNode with only index[16] after delete

pull/26480/head
qinglin89 2 years ago
parent 793f0f9ec8
commit ee78e8037b
  1. 4
      trie/trie.go

@ -472,7 +472,9 @@ func (t *Trie) delete(n node, prefix, key []byte) (bool, node, error) {
}
}
if pos >= 0 {
if pos != 16 {
if pos == 16 {
return true, n.Children[16].(valueNode), nil
} else {
// If the remaining entry is a short node, it replaces
// n and its key gets the missing nibble tacked to the
// front. This avoids creating an invalid

Loading…
Cancel
Save