.iter()
.enumerate()
.map(|(vout, output)| SignRawTransactionInput {
txid: commit_tx.txid(),
vout: vout.try_into().unwrap(),
script_pub_key: output.script_pubkey.clone(),
redeem_script: None,
amount: Some(Amount::from_sat(output.value)),
})
.collect::<Vec<SignRawTransactionInput>>(),
),
None,
)?
.hex
} else {
bitcoin::consensus::encode::serialize(&reveal_tx)
};
if !self.no_backup {
Self::backup_recovery_key(client, recovery_key_pair, chain.network())?;
}
let commit = client.send_raw_transaction(&signed_commit_tx)?;
let reveal = match client.send_raw_transaction(&signed_reveal_tx) {
Ok(txid) => txid,
Err(err) => {
return Err(anyhow!(
"Failed to send reveal transaction: {err}\nCommit tx {commit} will be recovered once mined"
))
}
};
Ok(Box::new(self.output(