Skip to content

Commit

Permalink
Find additionalfeeoutputindex from unsigned_psbt (#309)
Browse files Browse the repository at this point in the history
outputs map does not contain the script_pubkey, usigned_tx txos do.
PSBTv2 NOW!
  • Loading branch information
DanGould authored Nov 29, 2023
1 parent fe923c8 commit 5ccd956
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/bitcoin/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ pub async fn create_payjoin(
info!("Original PSBT successfully signed");

let additional_fee_index = psbt
.outputs
.unsigned_tx
.output
.clone()
.into_iter()
.enumerate()
.find(|(_, output)| {
.find(|(_, txo)| {
invoices.iter().all(|invoice| {
output.redeem_script != Some(invoice.address.script_pubkey())
&& output.witness_script != Some(invoice.address.script_pubkey())
txo.script_pubkey != invoice.address.script_pubkey()
})
})
.map(|(i, _)| i);
Expand Down

0 comments on commit 5ccd956

Please sign in to comment.