PSBTv2 (BIP-370) Support #87
Open
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.
This PR improves PSBT (Partially Signed Bitcoin Transaction) v2 support, especially strict validation and compatibility with BIP 370 test vectors. It also adds a comprehensive set of tests for PSBTv2 edge cases and locktime determination.
Details
1. PSBTv2 Compliance and Parsing Improvements
src/embit/liquid/pset.pyto allow passing theversionparameter down toread_valueand its parent implementations. This ensures correct handling of versioned PSBT fields.super().read_valueto pass along theversionargument, improving extensibility and correctness for PSBTv2.2. PSBT View Updates
src/embit/psbtview.py:input()andoutput()methods now pass theversionparameter when reading from the stream, allowing PSBT-in and out scopes to parse versioned fields correctly.3. Comprehensive PSBTv2 Test Vectors
tests/tests/test_psbtV2.pycontaining:Motivation
Testing
pytest tests/tests/test_psbtV2.pyto verify all BIP 370 test vectors and locktime cases.embitto confirm correct parsing — everything worked as expected.References