mpt: fix extension node cache invalidation

It should always be invalidated if something changes in the `next` (below the
extension node).

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Roman Khimov 2020-06-04 17:16:32 +03:00 committed by Evgenii Stratonikov
parent 0e29382035
commit caea6d6ca8

View file

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