[release/1.4.15] trie: fix delete bug for values contained in fullNode
Delete crashed if a fullNode contained a valueNode directly. This bug is
very unlikely to occur with SecureTrie, but can happen with regular
tries. This commit also introduces a randomised test which triggers all
trie operations, which should prevent such bugs in the future.
Credit for finding this bug goes to Github user @rjl493456442.
(cherry picked from commit c3a77d6268
)
This commit is contained in:
committed by
Péter Szilágyi
parent
d4608ae0d2
commit
968ab8aa4f
@ -374,6 +374,9 @@ func (t *Trie) delete(n node, prefix, key []byte) (bool, node, error) {
|
||||
// n still contains at least two values and cannot be reduced.
|
||||
return true, n, nil
|
||||
|
||||
case valueNode:
|
||||
return true, nil, nil
|
||||
|
||||
case nil:
|
||||
return false, nil, nil
|
||||
|
||||
|
Reference in New Issue
Block a user