for (current_index, txin) in reveal_tx.input.iter_mut().enumerate() {
// add dummy inscription witness for reveal input/commit output
if current_index == commit_input_index {
txin.witness.push(
Signature::from_slice(&[0; SCHNORR_SIGNATURE_SIZE])
.unwrap()
.to_vec(),
);
txin.witness.push(script);
txin.witness.push(&control_block.serialize());
} else {
txin.witness = Witness::from_slice(&[&[0; SCHNORR_SIGNATURE_SIZE]]);
}
}
fee_rate.fee(reveal_tx.vsize())
};
(reveal_tx, fee)
}
fn calculate_fee(tx: &Transaction, utxos: &BTreeMap<OutPoint, Amount>) -> u64 {
tx.input
.iter()
.map(|txin| utxos.get(&txin.previous_output).unwrap().to_sat())
.sum::<u64>()
.checked_sub(tx.output.iter().map(|txout| txout.value).sum::<u64>())
.unwrap()
}
}
#[derive(PartialEq, Debug, Copy, Clone, Serialize, Deserialize, Default)]
pub(crate) enum Mode {