Return EmptyTree instead of OverCompleteTree when there are no scripts
to add
This commit is contained in:
parent
ed3fb45c9a
commit
5813ec7ac0
|
@ -392,7 +392,7 @@ impl TaprootBuilder {
|
||||||
node_weights.push((Reverse(p), NodeInfo::new_leaf_with_ver(leaf, LeafVersion::TapScript)));
|
node_weights.push((Reverse(p), NodeInfo::new_leaf_with_ver(leaf, LeafVersion::TapScript)));
|
||||||
}
|
}
|
||||||
if node_weights.is_empty() {
|
if node_weights.is_empty() {
|
||||||
return Err(TaprootBuilderError::IncompleteTree);
|
return Err(TaprootBuilderError::EmptyTree);
|
||||||
}
|
}
|
||||||
while node_weights.len() > 1 {
|
while node_weights.len() > 1 {
|
||||||
// Combine the last two elements and insert a new node
|
// Combine the last two elements and insert a new node
|
||||||
|
|
Loading…
Reference in New Issue