Skip to content

Commit ecf876e

Browse files
committed
Rename function taptree_height to height
This is a private function on the `TapTree` struct, we can make the name more terse with no loss of meaning.
1 parent feae54c commit ecf876e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/descriptor/tr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ impl<Pk: MiniscriptKey> TapTree<Pk> {
111111
// Helper function to compute height
112112
// TODO: Instead of computing this every time we add a new leaf, we should
113113
// add height as a separate field in taptree
114-
fn taptree_height(&self) -> usize {
114+
fn height(&self) -> usize {
115115
match *self {
116116
TapTree::Tree(ref left_tree, ref right_tree) => {
117-
1 + max(left_tree.taptree_height(), right_tree.taptree_height())
117+
1 + max(left_tree.height(), right_tree.height())
118118
}
119119
TapTree::Leaf(..) => 0,
120120
}
@@ -167,7 +167,7 @@ impl<Pk: MiniscriptKey> Tr<Pk> {
167167
/// Create a new [`Tr`] descriptor from internal key and [`TapTree`]
168168
pub fn new(internal_key: Pk, tree: Option<TapTree<Pk>>) -> Result<Self, Error> {
169169
Tap::check_pk(&internal_key)?;
170-
let nodes = tree.as_ref().map(|t| t.taptree_height()).unwrap_or(0);
170+
let nodes = tree.as_ref().map(|t| t.height()).unwrap_or(0);
171171

172172
if nodes <= TAPROOT_CONTROL_MAX_NODE_COUNT {
173173
Ok(Self {

0 commit comments

Comments
 (0)