Add compile_tr_native() for Taptree-native policy compilation#906
Add compile_tr_native() for Taptree-native policy compilation#906kwsantiago wants to merge 3 commits intorust-bitcoin:masterfrom
Conversation
2a1f0ab to
ae5c7d3
Compare
|
In ae5c7d3: I like this approach. Letting the user provide a maximum and returning an error if we go past it is probably best for now. (Much) later I will overhaul the compiler API and provide a general set of control parameters, and hopefully we can unify all the different compilation functions into one, but for now I'd love to see this functionality: Can you:
I'm a little suspicious of your threshold expanding logic. Before I step through it more carefully, I'd like you to add some unit tests just in case it's wrong. Thanks! |
|
Ran nightly fmt, fixed the two doc links, and added tests for and(or(A,B),or(C,D)) (4 leaves + semantic match) and thresh(3,5) (10 distinct leaves). Also toned down the issue description re: your feedback. |
|
Thanks! Clever use of |
Closes #905
Adds
compile_tr_native()which decomposes allOrandThreshbranches into separate TapTree leaves instead of usingOP_IF/OP_NOTIFwithin a single leaf. Each leaf is compiled to branch-free Tapscript and assembled into a Huffman-weighted TapTree.Also refactors
enumerate_policy_treeinto a sharedenumerate_leaveshelper to avoid duplication.