Skip to content

Commit

Permalink
Merge pull request #158 from zoedberg/fix_tapret_detection
Browse files Browse the repository at this point in the history
add tapret tweak only when necessary
  • Loading branch information
dr-orlovsky authored Apr 19, 2024
2 parents f9813b7 + 0aa29fd commit a0c5c63
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/pay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,15 @@ impl Runtime {
let contract_id = invoice.contract.ok_or(CompletionError::NoContract)?;

let fascia = psbt.rgb_commit()?;
if let Some(output) = psbt.dbc_output::<TapretProof>() {
let terminal = output
.terminal_derivation()
.ok_or(CompletionError::InconclusiveDerivation)?;
let tapret_commitment = output.tapret_commitment()?;
self.wallet_mut()
.add_tapret_tweak(terminal, tapret_commitment)?;
if let (Some(_), _) = fascia.anchor.as_reduced_unsafe().as_split() {
if let Some(output) = psbt.dbc_output::<TapretProof>() {
let terminal = output
.terminal_derivation()
.ok_or(CompletionError::InconclusiveDerivation)?;
let tapret_commitment = output.tapret_commitment()?;
self.wallet_mut()
.add_tapret_tweak(terminal, tapret_commitment)?;
}
}

let witness_txid = psbt.txid();
Expand Down

0 comments on commit a0c5c63

Please sign in to comment.