From 55a7913e3b3b8907401032d88e410e564280cee8 Mon Sep 17 00:00:00 2001 From: DanGould Date: Mon, 18 Dec 2023 17:22:43 -0500 Subject: [PATCH] Support taproot PSBTs Sometimes taproot signers leave around taproot signing artifacts. Part of the spec is to remove unnecessary psbt data for counterparties, so this ensures removal of taproot variety unnecessary data too. --- payjoin/src/receive/mod.rs | 1 + payjoin/src/send/mod.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/payjoin/src/receive/mod.rs b/payjoin/src/receive/mod.rs index 3fe79b1c2..2b1f2b038 100644 --- a/payjoin/src/receive/mod.rs +++ b/payjoin/src/receive/mod.rs @@ -800,6 +800,7 @@ impl ProvisionalProposal { self.payjoin_psbt.inputs[i].witness_utxo = None; self.payjoin_psbt.inputs[i].final_script_sig = None; self.payjoin_psbt.inputs[i].final_script_witness = None; + self.payjoin_psbt.inputs[i].tap_key_sig = None; } Ok(PayjoinProposal { payjoin_psbt: self.payjoin_psbt, diff --git a/payjoin/src/send/mod.rs b/payjoin/src/send/mod.rs index 2cc1daac6..bca7d5cc7 100644 --- a/payjoin/src/send/mod.rs +++ b/payjoin/src/send/mod.rs @@ -988,11 +988,18 @@ fn clear_unneeded_fields(psbt: &mut Psbt) { psbt.unknown_mut().clear(); for input in psbt.inputs_mut() { input.bip32_derivation.clear(); + input.tap_internal_key.clear(); + input.tap_key_origins.clear(); + input.tap_key_sig.clear(); + input.tap_merkle_root.clear(); + input.tap_script_sigs.clear(); input.proprietary.clear(); input.unknown.clear(); } for output in psbt.outputs_mut() { output.bip32_derivation.clear(); + output.tap_internal_key.clear(); + output.tap_key_origins.clear(); output.proprietary.clear(); output.unknown.clear(); }