Function create_test_p2tr_transaction

Source
pub fn create_test_p2tr_transaction(
    txid: &str,
    vout: u32,
    address: &str,
    amount: u64,
    network: Network,
    _include_change: bool,
) -> Transaction
Expand description

Creates a test P2TR transaction with a dummy input and output.

This function is useful for testing purposes where we need a valid transaction with a specific output amount and address. To generate different transaction IDs that run in parallel, the function randomly selects the actual amount_sats value, while the chosen value is always greater than min_amount_sats.

§Arguments

  • txid - The previous output transaction ID.
  • vout - The previous output transaction index.
  • address - The P2TR address to send the funds to.
  • amount - The amount of satoshis to send.
  • network - The Bitcoin network (mainnet, testnet, etc.).

§Returns

A Bitcoin transaction with a dummy input and output.