Struct bitcoin_scripting::TaprootBuilder
source · pub struct TaprootBuilder { /* private fields */ }
Expand description
| Utility class to construct Taproot | outputs from internal key and script | tree. |
Implementations§
source§impl TaprootBuilder
impl TaprootBuilder
sourcepub fn combine(&mut self, a: NodeInfo, b: NodeInfo) -> NodeInfo
pub fn combine(&mut self, a: NodeInfo, b: NodeInfo) -> NodeInfo
| Combine information about a parent | Merkle tree node from its child nodes. |
sourcepub fn insert(&mut self, node: NodeInfo, depth: i32)
pub fn insert(&mut self, node: NodeInfo, depth: i32)
| Insert information about a node at a | certain depth, and propagate information | up. |
sourcepub fn valid_depths(&mut self, depths: &Vec<i32>) -> bool
pub fn valid_depths(&mut self, depths: &Vec<i32>) -> bool
| Check if a list of depths is legal (will | lead to IsComplete()). |
sourcepub fn add(
&mut self,
depth: i32,
script: &Script,
leaf_version: i32,
track: Option<bool>
) -> &mut TaprootBuilder
pub fn add( &mut self, depth: i32, script: &Script, leaf_version: i32, track: Option<bool> ) -> &mut TaprootBuilder
| Add a new script at a certain depth in | the tree. Add() operations must be called | in depth-first traversal order of binary | tree. If track is true, it will be included | in the GetSpendData() output. |
sourcepub fn add_omitted(&mut self, depth: i32, hash: &u256) -> &mut TaprootBuilder
pub fn add_omitted(&mut self, depth: i32, hash: &u256) -> &mut TaprootBuilder
| Like Add(), but for a Merkle node with | a given hash to the tree. |
sourcepub fn finalize(&mut self, internal_key: &XOnlyPubKey) -> &mut TaprootBuilder
pub fn finalize(&mut self, internal_key: &XOnlyPubKey) -> &mut TaprootBuilder
| Finalize the construction. Can only | be called when IsComplete() is true. | internal_key.IsFullyValid() must | be true. |
sourcepub fn get_output(&mut self) -> WitnessV1Taproot
pub fn get_output(&mut self) -> WitnessV1Taproot
| Compute scriptPubKey (after Finalize()). |
sourcepub fn get_spend_data(&self) -> TaprootSpendData
pub fn get_spend_data(&self) -> TaprootSpendData
| Compute spending data (after Finalize()). |