pub fn create_transaction_with_change<'a>(
txs_to_spend: impl Iterator<Item = &'a Transaction>,
output_indexes: Vec<usize>,
change: Option<u64>,
fee: u64,
) -> Transaction
Expand description
Creates a transaction that spends the outputs of specified indexes (if they exist) of every provided transaction and returns an optional change. Assumes that the outputs being spent have opTrueScript as their scriptPublicKey.
If some change is provided, creates two outputs, first one with the value of the spent outputs minus change
and fee
(in sompi) and second one of change
amount.
If no change is provided, creates only one output with the value of the spent outputs minus and fee
(in sompi)