From cdaba04e532da5df4cbac00597372b272a9e7d5c Mon Sep 17 00:00:00 2001 From: Brian Ebert Date: Tue, 15 Oct 2024 13:17:20 -0600 Subject: [PATCH] Update v0.rs Thank you, your repo is super helpful to me. I can't get v0.rs to sign the psbt as is. If psbt.bip32_derivation does not have public key : KeySource, the keypair never signs the transaction because psbt.sign calls bip32_sign_ecdsa() for ecdsa signatures, and bip32_sign_ecdsa() iterates over psbt.bip32_derivation, so I faked the BTreeMap entries for each pk. Thanks again! BE --- examples/v0.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/v0.rs b/examples/v0.rs index 3aa3d58..960e47e 100644 --- a/examples/v0.rs +++ b/examples/v0.rs @@ -85,7 +85,13 @@ fn main() -> anyhow::Result<()> { // data and would get them from there. psbt.inputs[0].witness_utxo = Some(alice.input_utxo()); psbt.inputs[1].witness_utxo = Some(bob.input_utxo()); - + + // if psbt.bip32_derivation does not have public key : KeySource, the keypair never signs the transaction because + // psbt.sign calls bip32_sign_ecdsa() for ecdsa signatures, and bip32_sign_ecdsa() iterates over psbt.bip32_derivation + let fake_fp: [u8; 4] = [0; 4]; + psbt.inputs[0].bip32_derivation.insert(alice.0.pk.clone(), (Fingerprint::from(fake_fp), DerivationPath::from_str("m")?)); + psbt.inputs[1].bip32_derivation.insert(bob.0.pk.clone(), (Fingerprint::from(fake_fp), DerivationPath::from_str("m")?)); + // Since we are spending 2 p2wpkh inputs there are no other updates needed. // Each party signs a copy of the PSBT.