Add compile_tr_native() for Taptree-native policy compilation#906
Open
kwsantiago wants to merge 3 commits intorust-bitcoin:masterfrom
Open
Add compile_tr_native() for Taptree-native policy compilation#906kwsantiago wants to merge 3 commits intorust-bitcoin:masterfrom
kwsantiago wants to merge 3 commits intorust-bitcoin:masterfrom
Conversation
2a1f0ab to
ae5c7d3
Compare
Member
|
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! |
Author
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.