-
Notifications
You must be signed in to change notification settings - Fork 38.7k
test: bug fix in transaction_tests #21280
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
Conversation
|
@MarcoFalke thanks for catching the bug - this should fix it |
1fde7a4 to
0f6d0ff
Compare
|
Cirrus failure is in feature_blockfilterindex_prune.py, which I'm pretty sure is unrelated, given that this is only touching the unit tests |
c0295c4 to
f5e150a
Compare
This exact test is also already in tx_invalid.json#L29 It will also test with no-P2SH flags, so duplicating with different flags is not necessary.
f5e150a to
a944a21
Compare
jnewbery
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.
utACK a944a21be41d1e5469822b1858c304c983010880
f61876c to
24f2951
Compare
|
Updates: |
jnewbery
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.
ACK 24f2951e11d0aa88e3b45271ec457abaadc6fde0
A few small style suggestions inline if you retouch this.
PR bitcoin#19168 introduced this function but it always returns an empty vector.
Add missing script verify flags to mapFlagNames. iterate through mapFlagNames values instead of bits. BOOST_CHECK_MESSAGE better reports which test failed exactly, whereas BOOST_ERROR was just incrementing the error counter.
Similar to 19db590, which removed these for the valid tests. Not removing ones that cause a false/empty stack error because these tests should fail due to being invalid with CSV/CLTV
There is no way to iterate through all script verification flags, and it's not guaranteed that every power of 2 is used. Just make sure that all flags in STANDARD_SCRIPT_VERIFY_FLAGS are present in mapFlagNames; this covers all consensus and policy flags. If mapFlagNames has more flags than STANDARD_SCRIPT_VERIFY_FLAGS, that's okay. Nonexistent flags will be caught by the compiler.
|
Addressed the compiler warning about unused variable and @jnewbery's comments - thanks! |
|
utACK b109bde |
| [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "500000001 CHECKLOCKTIMEVERIFY"]], | ||
| "01000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000065cd1d", "CHECKLOCKTIMEVERIFY"], | ||
| [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4294967295 CHECKLOCKTIMEVERIFY 1"]], | ||
| [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "4294967295 CHECKLOCKTIMEVERIFY"]], |
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.
It might be nice to check the exact script reject reason instead of just failure
b109bde [test] check that mapFlagNames is up to date (glozow) 5d3ced7 [test] remove unnecessary OP_1s from invalid tests (glozow) 5aee73d [test] minor improvements / followups (glozow) 8a365df [test] fix bug in ExcludeIndividualFlags (glozow) 8cac292 [test] remove invalid test from tx_valid.json (glozow) Pull request description: This is a followup to bitcoin#19698. - There was a bug in the `ExcludeIndividualFlags` function which is fixed here. - Fixing this bug also showed that there is a test that's supposed to fail (already existing in tx_invalid.json) in tx_valid.json, so I removed it. Other than that, the tests should all pass. - Also implements a few suggestions I received offline: removing the `OP_1`s from the invalid tests (similar to bitcoin@19db590), comments, and style. - A few other small fixes, like adding asserts, putting all the flags in `mapFlagNames`, better error messages ACKs for top commit: jnewbery: utACK b109bde Tree-SHA512: 7233a8c0f1ae1172fac8000ea6e05384ecf79074c39948d118464868505c7f02f17e96503c81bd05c07adb2087648a5d93d9899e16fdefa6b7efcb51319444a9
This is a followup to #19698.
ExcludeIndividualFlagsfunction which is fixed here.OP_1s from the invalid tests (similar to 19db590), comments, and style.mapFlagNames, better error messages