Skip to content

fix: preserve previously finalized PSBT inputs#960

Merged
apoelstra merged 1 commit into
rust-bitcoin:masterfrom
trevarj:preserve_finalized_PSBTs
May 24, 2026
Merged

fix: preserve previously finalized PSBT inputs#960
apoelstra merged 1 commit into
rust-bitcoin:masterfrom
trevarj:preserve_finalized_PSBTs

Conversation

@trevarj
Copy link
Copy Markdown
Contributor

@trevarj trevarj commented May 22, 2026

Skip re-finalizing PSBT inputs that already have final_script_sig or
final_script_witness which could cause a failure if re-finalized.

See bitcoindevkit/bdk_wallet#488

Fixes #958 and requires backport to v13.x

Skip re-finalizing PSBT inputs that already have `final_script_sig` or
`final_script_witness` which could cause a failure if re-finalized.

See bitcoindevkit/bdk_wallet#488
@apoelstra
Copy link
Copy Markdown
Member

Yeah, I think this is probably the correct logic (if either field is set, then leave them alone).

Didn't check that the unit test too carefully. In future, it's helpful if you can put unit/regression tests in a later commit, so I can use git rebase -i to remove the fix and confirm that the test fails.

Queued for ack.

Will need backport to 13.x.

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK a0f6342; successfully ran local tests

@trevarj
Copy link
Copy Markdown
Contributor Author

trevarj commented May 24, 2026

In future, it's helpful if you can put unit/regression tests in a later commit, so I can use git rebase -i to remove the fix and confirm that the test fails.

Noted! Thanks

@apoelstra apoelstra merged commit 55356b0 into rust-bitcoin:master May 24, 2026
27 checks passed
apoelstra added a commit that referenced this pull request May 25, 2026
7d2c3ae fix: preserve previously finalized PSBT inputs (Trevor Arjeski)

Pull request description:

  This is a back-port of #960 to the 12.x branch. 
  BDK still uses miniscript v12.x
  
  
  It preserves PSBT inputs that already have `final_script_sig` or `final_script_witness`, avoiding re-finalization failures when finalized inputs no longer contain fields such as `witness_script` or `partial_sigs`.


ACKs for top commit:
  apoelstra:
    ACK 7d2c3ae; successfully ran local tests


Tree-SHA512: 6877725b9a25567583eeac592efb9817cead502995c02e220d54b042f70e23c46f9f7b44ddf9be912a6e0a468634546fbaba4745ac01c409ba9661f32bbdb6c3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PsbtExt::finalize re-finalizes already finalized inputs

2 participants