Skip to content

Commit

Permalink
fix(trie): descendants count for clear prefix (#2606)
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Jun 29, 2022
1 parent 2a6fa83 commit 1826896
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/trie/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -877,10 +877,11 @@ func (t *Trie) clearPrefix(parent *Node, prefix []byte) (
return parent, nodesRemoved
}

nodesRemoved = 1
nodesRemoved = 1 + child.Descendants
copySettings := node.DefaultCopySettings
branch = t.prepBranchForMutation(branch, copySettings)
branch.Children[childIndex] = nil
branch.Descendants -= nodesRemoved
var branchChildMerged bool
newParent, branchChildMerged = handleDeletion(branch, prefix)
if branchChildMerged {
Expand Down

0 comments on commit 1826896

Please sign in to comment.