merkletree: replace IsComplete with more useful ContainsFirstN

This commit is contained in:
Andrew Ayer 2024-10-16 08:23:22 -04:00 committed by Dirk Stöcker
parent c298970b68
commit 1b441660ab
1 changed files with 3 additions and 2 deletions

View File

@ -90,8 +90,9 @@ func (tree FragmentedCollapsedTree) Subtrees() []CollapsedTree {
}
}
func (tree FragmentedCollapsedTree) IsComplete(size uint64) bool {
return len(tree.subtrees) == 1 && tree.subtrees[0].offset == 0 && tree.subtrees[0].size == size
// Return true iff the tree contains at least the first n nodes (without any gaps)
func (tree FragmentedCollapsedTree) ContainsFirstN(n uint64) bool {
return len(tree.subtrees) >= 1 && tree.subtrees[0].offset == 0 && tree.subtrees[0].size >= n
}
func (tree *FragmentedCollapsedTree) Init(subtrees []CollapsedTree) error {