Skip to content

psbt: Clean up a few TODOs - #1043

Open
Abeeujah wants to merge 6 commits into
rust-bitcoin:masterfrom
Abeeujah:2026-02-wip
Open

psbt: Clean up a few TODOs#1043
Abeeujah wants to merge 6 commits into
rust-bitcoin:masterfrom
Abeeujah:2026-02-wip

Conversation

@Abeeujah

@Abeeujah Abeeujah commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

This PR removes a few TODOs in the psbt module which were
blocked on upstream at the time, but now available in
rust-bitcoin 0.32.6 and adds a few other QOL refinements
to the PSBT module.

  • Patch 1 - Checks pubkey hashes equivalence without roundtripping through Address.
  • Patch 2 - emoves the redundant SigHash::All after Input::ecdsa_hash_ty method call.
  • Patch 3 - Clean up typo from PsbtInputSatisfier docs.
  • Patch 4 - Combine find and map calls to find_map in PsbtInputSatisfier lookup* methods.
  • Patch 5 - Refactor PsbtExt finalize_mut* methods to use Iterators and Combinators.
  • Patch 6 - Nitpicks psbt::finalizer module for micro improvments.

@apoelstra

Copy link
Copy Markdown
Member

CI is failing.

Compares pubkey hashes via their byte representation, eliminating
the need to roundtrip via Address, also eliminating a bug that could
make partial sigs lose their compressed flag.
This removes the redundant assignment of EcdsaSighashType::All
after the method call to Input::ecdsa_hash_ty.

Input::ecdsa_hash_ty defaults to EcdsaSighashType::All if no
EcdsaSighashType is specified.
This leverages Rust's Iterator and Option API to create the value
at the point the find expression matches instead of doing the find
and map in separate calls.
This patch replaces the for loop, match and if/else constructs used
to finalize inputs, collect errors and report the errors; using
Iterator::filter_map and bool::then_some.
- `finalizer::construct_tap_witness`: Satisfy Psbt Inputs using
Iterators on the PsbtInputSatisfier.
- `finalizer::interpreter_check`: Move ScriptBuf and Witness out of
the for loop to prevent allocating per iteration.
- `finalizer::finalize_input`: Collapse verbose if/else statements
to `bool::then_some`.
@Abeeujah

Abeeujah commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

CI is failing.

Sorry, my Indexing was off by one, It has been fixed.

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.

2 participants