1
0
mirror of https://github.com/bitcoin/bips.git synced 2026-07-27 18:13:38 +00:00
Commit Graph

2 Commits

Author SHA1 Message Date
conduition
98c0289805 bip360: simplify computing control blocks using explicit traversal paths
This refactors `compute_control_block` to improve performance, and make
the function simpler to read (to me at least).

The previous version walked the entire script tree searching for the
first matching instance of the leaf node.

The new version expects the caller to pass in an explicit `path`
parameter, which tells us exactly where the leaf node lives, with
left/right steps encoded as bits in an integer. We walk down the
tree straight to that leaf node, and build the control block as we go.

This might not be the best DX for a real-world API or library, but this
is just reference code, so we can accept poor usage ergonomics if it makes
the code clearer and more explicit.
2026-06-27 01:11:26 +00:00
notmike
29e1a158e7 bip-0360: added python reference example; test vector fixes
This commit adds a python reference example for construction of BIP-360 outputs and control blocks.
This commit also updates the test vectors.
2026-06-26 13:20:03 -06:00