From 56adfa45279cfc3bc9ad20ad6e9f9909b73a880d Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Fri, 1 Apr 2022 08:06:18 +0200 Subject: [PATCH] TaprootBuilder::has_hidden_nodes method --- src/util/taproot.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/util/taproot.rs b/src/util/taproot.rs index 440792ab..1fc7a4f9 100644 --- a/src/util/taproot.rs +++ b/src/util/taproot.rs @@ -466,6 +466,18 @@ impl TaprootBuilder { self.branch.len() == 1 && self.branch[0].is_some() } + /// Checks if the builder has hidden nodes. + pub fn has_hidden_nodes(&self) -> bool { + for node in &self.branch { + if let Some(node) = node { + if node.has_hidden_nodes { + return true + } + } + } + false + } + /// Creates a [`TaprootSpendInfo`] with the given internal key. pub fn finalize( mut self,