psbt: misc fixes and add remaining BIP 174 and BIP 370 test vectors - #839
Open
Sjors wants to merge 8 commits into
Open
psbt: misc fixes and add remaining BIP 174 and BIP 370 test vectors #839Sjors wants to merge 8 commits into
Sjors wants to merge 8 commits into
Conversation
Merged
Member
Author
|
Ready now that #836 landed. |
Sjors
marked this pull request as ready for review
August 1, 2026 18:22
achow101
reviewed
Aug 5, 2026
| self.assertEqual(psbt.tx.vin[0].nSequence, 0xfffffffe) | ||
| self.assertEqual(len(psbt.tx.vout), 2) | ||
|
|
||
| def test_convert_to_v0_locktime(self): |
Member
There was a problem hiding this comment.
In 629c9b8 "psbt: set locktime on the transaction, not the PSBT"
Can you combine this with the other test case instead of making a new one? It's basically the same transaction.
Member
Author
There was a problem hiding this comment.
If dropped test_convert_to_v0_default_sequence and test_convert_to_v0_locktime, using both fields in the generic test_convert_to_v0.
get_unsigned_tx() assigned the computed locktime to a stray attribute on the PSBT, so the constructed transaction kept locktime 0.
get_unsigned_tx() asserted that every input has a sequence number, crashing on the minimal BIP 370 test vector.
The witness-detecting deserializer accepted witness-serialized unsigned transactions and misread valid ones with no inputs.
A provided unsigned tx with no inputs and outputs is indistinguishable from the empty placeholder.
The global PSBTv2 fields were already rejected.
compute_lock_time() was previously untested.
The test data now covers every vector from both BIPs; these all already pass.
Member
Author
|
Improved the test, rebased just in case. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each fix / hardening commit introduces the test vectors that cover it.
Mostly straight-forward, but
psbt: parse the global unsigned tx without witness datais worth a closer look. IIUC it catches up with bitcoin/bips#1099.