mpt: fix extension node cache invalidation

It should always be invalidated if something changes in the `next` (below the
extension node).
This commit is contained in:
Roman Khimov 2020-06-04 17:16:32 +03:00
parent 24785f1f50
commit f77c239296

View file

@ -261,7 +261,6 @@ func (t *Trie) deleteFromExtension(n *ExtensionNode, path []byte) (Node, error)
case *ExtensionNode: case *ExtensionNode:
n.key = append(n.key, nxt.key...) n.key = append(n.key, nxt.key...)
n.next = nxt.next n.next = nxt.next
n.invalidateCache()
case *HashNode: case *HashNode:
if nxt.IsEmpty() { if nxt.IsEmpty() {
return nxt, nil return nxt, nil
@ -269,6 +268,7 @@ func (t *Trie) deleteFromExtension(n *ExtensionNode, path []byte) (Node, error)
default: default:
n.next = r n.next = r
} }
n.invalidateCache()
return n, nil return n, nil
} }