Skip to content

Commit

Permalink
tmp: debug duplicated outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Mar 24, 2024
1 parent 8b2fbd8 commit c0c16ca
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/pay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,13 @@ impl Runtime {
.iter()
// TODO: Support liquid
.map(|o| o.as_reduced_unsafe())
.map(|o| Outpoint::new(o.txid, o.vout));
.map(|o| Outpoint::new(o.txid, o.vout)).collect::<BTreeSet<_>>();
params.tx.change_keychain = RgbKeychain::for_method(method).into();
let (mut psbt, mut meta) =
self.wallet_mut()
.construct_psbt(prev_outpoints, &beneficiaries, params.tx)?;
let (mut psbt, mut meta) = self.wallet_mut().construct_psbt(
prev_outpoints.iter().copied(),
&beneficiaries,
params.tx,
)?;

let beneficiary_script =
if let Beneficiary::WitnessVout(addr) = invoice.beneficiary.into_inner() {
Expand Down Expand Up @@ -294,7 +296,14 @@ impl Runtime {
Beneficiary::BlindedSeal(_) => None,
};
let batch = self
.compose(invoice, prev_outputs, method, beneficiary_vout, |_, _, _| meta.change_vout)?;
.compose(invoice, prev_outputs.iter().copied(), method, beneficiary_vout, |_, _, _| {
meta.change_vout
})
.inspect_err(|_| {
eprintln!("{}", &serde_yaml::to_string(&psbt).unwrap());
eprintln!("{prev_outputs:#?}");
eprintln!("{prev_outpoints:#?}");
})?;

let methods = batch.close_method_set();
if methods.has_opret_first() {
Expand Down

0 comments on commit c0c16ca

Please sign in to comment.