Skip to content

Add compile_tr() for Taptree-native policy compilation#270

Open
kwsantiago wants to merge 6 commits intobitcoinknots:29.x-knotsfrom
privkeyio:compile-tr-native
Open

Add compile_tr() for Taptree-native policy compilation#270
kwsantiago wants to merge 6 commits intobitcoinknots:29.x-knotsfrom
privkeyio:compile-tr-native

Conversation

@kwsantiago
Copy link
Copy Markdown

@kwsantiago kwsantiago commented Mar 3, 2026

Adds compile_tr() which decomposes all Or and Thresh branches into separate TapTree leaves instead of using OP_IF/OP_NOTIF within a single leaf. Each leaf is compiled to branch-free Tapscript and assembled into a Huffman-weighted TapTree.

Also adds HasBranchingOpcodes() to miniscript::Node for detecting OP_IF/OP_NOTIF-emitting fragments in compiled Tapscript.

For reference: rust-bitcoin/rust-miniscript#906

Comment thread src/script/descriptor.cpp
internal_keys.emplace_back(internal_keys.at(0)->Clone());
}

key_exp_index += parser.m_keys.size();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is key_exp_index used? (I've searched throughout the parser and I don't see it ever used.)

Comment thread src/script/descriptor.cpp
}
ret.emplace_back(std::make_unique<TRDescriptor>(std::move(internal_keys.at(mp)), std::move(descs), depths));
}
return ret;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where can I find design material on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants