Skip to content

Commit

Permalink
add tapret tweak only when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
zoedberg committed Apr 3, 2024
1 parent ec0b4e4 commit 0aa29fd
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 @@ -315,13 +315,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 0aa29fd

Please sign in to comment.