Skip to content

Commit 6b70a6a

Browse files
committed
Merge rust-bitcoin/rust-miniscript#617: Improve TapTree API
0630491aee647a6cdcbe6c876a51fad08e918840 Make TapTree::height public (Tobin C. Harding) cdb57cb42a3ef89619b3a5085e742fcb673efd89 Make TapTree::combine public (Tobin C. Harding) Pull request description: Improve the `TapTree` API by making the `height` and `combine` methods public. Note the serendipitous finding that upgrading miniscript to use bitcoin v0.31.0-rc1 requires no changes. I found these fixes doing the `bdk` upgrade. ACKs for top commit: apoelstra: ACK 0630491aee647a6cdcbe6c876a51fad08e918840 Tree-SHA512: bafb91cc34e353bab7b952f8cfa8674f4918422879b0514d1bc0f7a2e00af3d5103f133eb65488ad3ff96ea0801292b863c74d1e2523fe1d67dea8ce8fb662af
2 parents 9586923 + 35debd5 commit 6b70a6a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/descriptor/tr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ impl<Pk: MiniscriptKey> hash::Hash for Tr<Pk> {
118118

119119
impl<Pk: MiniscriptKey> TapTree<Pk> {
120120
/// Creates a `TapTree` by combining `left` and `right` tree nodes.
121-
pub(crate) fn combine(left: TapTree<Pk>, right: TapTree<Pk>) -> Self {
121+
pub fn combine(left: TapTree<Pk>, right: TapTree<Pk>) -> Self {
122122
let height = 1 + cmp::max(left.height(), right.height());
123123
TapTree::Tree { left: Arc::new(left), right: Arc::new(right), height }
124124
}
125125

126126
/// Returns the height of this tree.
127-
fn height(&self) -> usize {
127+
pub fn height(&self) -> usize {
128128
match *self {
129129
TapTree::Tree { left: _, right: _, height } => height,
130130
TapTree::Leaf(..) => 0,

0 commit comments

Comments
 (0)