mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
trie: remove nodes in the middle of shortNode and fullNode
This commit is contained in:
parent
90d5bd85bc
commit
53fefd79b2
2 changed files with 8 additions and 0 deletions
|
|
@ -63,6 +63,11 @@ func (c *committer) commit(path []byte, n node) node {
|
|||
// otherwise it can only be hashNode or valueNode.
|
||||
if _, ok := cn.Val.(*fullNode); ok {
|
||||
collapsed.Val = c.commit(append(path, cn.Key...), cn.Val)
|
||||
|
||||
// Mark all internal nodes between parent and child as deleted.
|
||||
for i := 1; i < len(cn.Key); i++ {
|
||||
c.nodes.AddNode(append(path, cn.Key[:i]...), trienode.NewDeleted())
|
||||
}
|
||||
}
|
||||
// The key needs to be copied, since we're adding it to the
|
||||
// modified nodeset.
|
||||
|
|
|
|||
|
|
@ -378,6 +378,9 @@ func testIteratorContinueAfterError(t *testing.T, memonly bool, scheme string) {
|
|||
)
|
||||
if memonly {
|
||||
for path, n := range nodes.Nodes {
|
||||
if n.IsDeleted() {
|
||||
continue
|
||||
}
|
||||
paths = append(paths, []byte(path))
|
||||
hashes = append(hashes, n.Hash)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue