-
Notifications
You must be signed in to change notification settings - Fork 38.6k
test: add test for decoding PSBT with per-input preimage types #25625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add test for decoding PSBT with per-input preimage types #25625
Conversation
0095429 to
4dc573e
Compare
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Concept ACK |
|
ACK 4dc573e78976dc2728464714a589f4bc2a07e37d |
brunoerg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crACK 4dc573e78976dc2728464714a589f4bc2a07e37d
|
concept ACK, moving the PSBT utility functions into the testing framework proper is something I wanted regardless |
…ner) -BEGIN VERIFY SCRIPT- sed -i s/FromBinary/from_binary/g ./contrib/signet/miner -END VERIFY SCRIPT-
Can be easily reviewed with `--color-moved=dimmed-zebra`.
Can be easily reviewed with `--color-moved=dimmed-zebra`.
Also take use of the constants in the signet miner to get rid of magic numbers and increase readability and maintainability.
4dc573e to
94dbcdc
Compare
instagibbs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good aside from one question of mine
test/functional/rpc_psbt.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the first instance of urandom in the test framework. Can we make it seed-determined instead, so that failures can be diagnosed easier?
If we don't expect failures due to randomness, we probably shouldn't do it at all then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I agree that seed-determined randomness is preferred here. Moved the random_bytes helper (which uses random.getrandbits) from the taproot test to the utils library and used that instead. Note that Python 3.9 offers random.randbytes(), but unfortunately we have Python 3.6 as minimum requirement.
Can be easily reviewed with `--color-moved=dimmed-zebra`.
94dbcdc to
71a751f
Compare
|
Force-pushed with feedback taken from instagibb's review comment, i.e. the random bytes are now generated with the |
|
ACK 71a751f |
This PR adds missing test coverage for the
decodepsbtRPC in the case that a PSBT with on of the per-input preimage types (PSBT_IN_RIPEMD160,PSBT_IN_SHA256,PSBT_IN_HASH160,PSBT_IN_HASH256; see BIP 174) is passed. As preparation, the first four commits move the already existing helpers for (de)serialization of PSBTs and PSBTMaps from the signet miner to the test framework (in a new modulepsbt.py), which should be quite useful for further tests to easily create PSBTs.