fix(compile): compile only for the requested script context - #317
vadim-anfv wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #317 +/- ##
==========================================
+ Coverage 59.79% 60.09% +0.29%
==========================================
Files 22 22
Lines 3878 3869 -9
==========================================
+ Hits 2319 2325 +6
+ Misses 1559 1544 -15
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:
|
c626394 to
eb8ca3f
Compare
eb8ca3f to
6ed624e
Compare
6ed624e to
85a7144
Compare
|
ACK 6ed624e
|
Compiling for all three contexts let the narrowest one reject a policy that is valid for the requested type: a 9-of-16 multisig, fine as taproot multi_a, failed even for --type tr because legacy hit the 520-byte consensus limit on script elements. The same policy also panicked for --type wsh, which the test now covers.
85a7144 to
6e64d8f
Compare
Thanks for testing!
Added the
On |
The policy is compiled for all three script contexts one after another, before
--typeis looked at, and any of those failing aborts the command. So a policy that is valid for the type you asked for is rejected because it is invalid for one of the other two.Here a 9-of-16 multisig is compiled with
--type trand fails on the legacy context:CHECKMULTISIGtakes at most 15 keys, and what the compiler falls back to goes pastMAX_SCRIPT_ELEMENT_SIZE, the 520-byte consensus limit. Taproot has no such limit.The fix moves the compilation into the matching branch, so only the requested context is compiled.
Changelog notice
compilerejecting policies that are valid for the requested script typeChecklists
All Submissions:
cargo fmtandcargo clippybefore committingBugfixes: