feat: expose detailed try_finalize_psbt outcomes#433
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #433 +/- ##
==========================================
+ Coverage 80.96% 81.15% +0.19%
==========================================
Files 24 24
Lines 5489 5552 +63
Branches 247 247
==========================================
+ Hits 4444 4506 +62
- Misses 968 970 +2
+ Partials 77 76 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
c65f534 to
e046adc
Compare
|
Updated per some good feedback from mammal |
f3fb2a6 to
69966b6
Compare
ValuedMammal
left a comment
There was a problem hiding this comment.
I don't think After and Older are doing much good, and would prefer to leave them out of the new implementation if we plan to support try_finalize_psbt into the future.
|
Concept ACK, glad to see this as a non-breaking change. |
|
Added four commits as small follow-ups from review feedback from mammal: make finalization cleanup more explicit, preserve opaque PSBT/input metadata, stop the new |
|
tACK 09d2cd0 The concept and approach make sense. I fetched the branch and ran the tests locally, and they all pass. The documentation also clearly specifies when to use the finalize_psbt and try_finalize_psbt methods. |
| } | ||
|
|
||
| /// Whether all inputs are finalized after this call. | ||
| pub fn is_finalized(&self) -> bool { |
There was a problem hiding this comment.
If outcomes is empty (e.g. a PSBT with no inputs), is_finalized() returns true, since .all() on an empty iterator is true. Is this the intended behavior or worth documenting/guarding against explicitly?
There was a problem hiding this comment.
I think this is intended since is_finalized() is only answering whether any input failed finalization, so if there are no inputs there is nothing to fail. This also matches the old finalize_psbt behavior where finished started as true and only changed inside the input loop. But that's my take, open to further thoughts
|
ACK ec3a683 |
|
let final_script_witness =
(!tmp_input.witness.is_empty()).then_some(tmp_input.witness);
- // BIP174 finalization clears input metadata except UTXOs, final scripts,
- // and opaque fields the finalizer does not understand.
+ // BIP174 finalization clears input metadata except UTXOs, final
+ // scripts, and opaque fields the finalizer
+ // does not understand.
*psbt_input = bitcoin::psbt::Input {
non_witness_utxo: original.non_witness_utxo,
witness_utxo: original.witness_utxo, |
Description
Close #73
This PR keeps the scope to PSBT finalization only:
try_finalize_psbtwhich returnsFinalizePsbtOutcomeFinalizeInputOutcomeNotes to the reviewers
This is now additive rather than breaking:
Wallet::finalize_psbtstill returnsboolIntentionally not included here:
Wallet::signto return a richer result typeChangelog notice
Wallet::try_finalize_psbt, which returnsFinalizePsbtOutcomeand exposes per-input finalization outcomes while preserving the existingWallet::finalize_psbtAPI.Checklists
All Submissions:
just pbefore pushingNew Features: