Skip to content

Commit

Permalink
fix(trie): descendants count for clear prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Jun 17, 2022
1 parent 223cfbb commit 5d89380
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 5d89380

Please sign in to comment.