pub struct TapscriptTreeBuilder { /* private fields */ }Expand description
Builder for complex Tapscript trees
Implementations§
Source§impl TapscriptTreeBuilder
impl TapscriptTreeBuilder
Sourcepub fn add_simple_leaf(&mut self, script: Vec<u8>)
pub fn add_simple_leaf(&mut self, script: Vec<u8>)
Add a simple script leaf with default weight
Sourcepub fn build_balanced(&self) -> Result<TapscriptNode, BitcoinError>
pub fn build_balanced(&self) -> Result<TapscriptNode, BitcoinError>
Build a balanced tree (not optimized)
Sourcepub fn build_huffman(&self) -> Result<TapscriptNode, BitcoinError>
pub fn build_huffman(&self) -> Result<TapscriptNode, BitcoinError>
Build a Huffman-coded tree (optimized for weights)
Creates a tree where more frequently used scripts (higher weight) have shorter paths, reducing witness size.
Sourcepub fn generate_proof(
&self,
tree: &TapscriptNode,
target_script: &[u8],
) -> Result<MerkleProof, BitcoinError>
pub fn generate_proof( &self, tree: &TapscriptNode, target_script: &[u8], ) -> Result<MerkleProof, BitcoinError>
Generate Merkle proof for a specific script
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TapscriptTreeBuilder
impl RefUnwindSafe for TapscriptTreeBuilder
impl Send for TapscriptTreeBuilder
impl Sync for TapscriptTreeBuilder
impl Unpin for TapscriptTreeBuilder
impl UnwindSafe for TapscriptTreeBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more