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

11 Commits

Author SHA1 Message Date
notmike
9bf46b5cfe bip360: make consistent use of h2b 2026-06-26 20:03:12 -06:00
notmike
50a6b91352 bip360: simplify tapbranch_hash function
Implements @conduitions improvement on tapbranch_hash()

Co-authored-by: conduition <conduition@proton.me>
2026-06-26 20:00:28 -06:00
notmike
2706a6181d bip360: Optional type removed / no longer needed 2026-06-26 19:35:32 -06:00
conduition
1325ccc7db return type is not optional anymore 2026-06-27 01:15:28 +00:00
conduition
86e7f9d4ca add new test case for duplicate script leaves 2026-06-27 01:12:47 +00:00
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
jbride
8d28eb4517 bip360 test vectors: control block now reflects use of non-standard
leaf version
2026-06-25 19:59:03 -06:00
jbride
907db20348 bip360 test vectors: non-standard leaf version should be allowed during construction of P2MR output (#46) 2026-06-25 19:59:03 -06:00
jbride
35b9ffe21b bip360 test vectors: elements in control block array should be ordered to match tree structure of test vectors (#45) 2026-06-25 19:59:03 -06:00
Hunter Beast
eae7d9fc57 BIP360: Pay to Merkle Root (P2MR) (#1670)
Review comments and assistance by:
  Armin Sabouri <armins88@gmail.com>
  D++ <82842780+dplusplus1024@users.noreply.github.com>
  Jameson Lopp <jameson.lopp@gmail.com>
  jbride <jbride2001@yahoo.com>
  Joey Yandle <xoloki@gmail.com>
  Jon Atack <jon@atack.com>
  Jonas Nick <jonasd.nick@gmail.com>
  Kyle Crews <kylecrews@Kyles-Mac-Studio.local>
  Mark "Murch" Erhardt <murch@murch.one>
  notmike-5 <notmike-5@users.noreply.github.com>
  Vojtěch Strnad <43024885+vostrnad@users.noreply.github.com>

Co-authored-by: Ethan Heilman <ethan.r.heilman@gmail.com>
Co-authored-by: Isabel Foxen Duke <110147802+Isabelfoxenduke@users.noreply.github.com>
2026-02-11 13:01:47 -08:00