Merge #1519: fix: merge Taproot sigs when updating PSBT

86e30d2d839462fc063702e3f4430656073a6aa2 fix: merge Taproot sigs when updating PSBT (Michael Mallan)

Pull request description:

  While testing #1513, it became apparent that Taproot signatures were not being merged properly when updating a PSBT.

  This PR fixes and refactors the code to use the `merge_signatures` function that contains the required logic.

ACKs for top commit:
  edouardparis:
    utACK 86e30d2d839462fc063702e3f4430656073a6aa2

Tree-SHA512: ba07d8d2e612d41a3960c5ce04258775334ca22c5268d51822d4e1fbce9614424937e72e688b6006946064c3c04581c20ca2f159bb1bc2a916d98e7e1ef2dc7b
This commit is contained in:
edouardparis 2025-01-06 17:05:49 +01:00
commit caa5e54f01
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F

View File

@ -692,27 +692,7 @@ impl Action for UpdateAction {
self.success = true;
self.error = None;
let psbt = Psbt::from_str(&self.updated.value).expect("Already checked");
for (i, input) in tx.psbt.inputs.iter_mut().enumerate() {
if tx
.psbt
.unsigned_tx
.input
.get(i)
.map(|tx_in| tx_in.previous_output)
!= psbt
.unsigned_tx
.input
.get(i)
.map(|tx_in| tx_in.previous_output)
{
continue;
}
if let Some(updated_input) = psbt.inputs.get(i) {
input
.partial_sigs
.extend(updated_input.partial_sigs.clone().into_iter());
}
}
merge_signatures(&mut tx.psbt, &psbt);
tx.sigs = self
.wallet
.main_descriptor