clementine_core::builder::transaction

Function create_taproot_output_with_hidden_node

Source
pub fn create_taproot_output_with_hidden_node(
    script: Arc<dyn SpendableScript>,
    hidden_node: &'_ [u8; 32],
    amount: Amount,
    network: Network,
) -> UnspentTxOut
Expand description

Helper function to create a Taproot output that combines a single script and a root hash containing any number of scripts. The main use case for this function is to speed up the tx creating during a deposit. We don’t need to create and combine all the scripts in the taproot repeatedly, but cache and combine the common scripts for each kickoff tx to a root hash, and add an additional script that depends on the specific operator or nofn_pk that is signing the deposit.

§Arguments

  • script - The one additional script to include in the merkle tree.
  • hidden_node - The root hash for the merkle tree node. The node can contain any number of scripts.
  • amount - The output amount.
  • network - The Bitcoin network.

§Returns

An UnspentTxOut representing the Taproot TxOut.