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

bip360: mask tapleaf_version in tapleaf_hash

This commit is contained in:
notmike
2026-06-27 22:40:15 -06:00
parent 94b0f9db4c
commit 75167ec077

View File

@@ -79,7 +79,7 @@ def tapleaf_hash(script: bytes, tapleaf_ver: int = 0xc0) -> bytes:
"""Hash function for tree leaves""" """Hash function for tree leaves"""
if not script: if not script:
raise ValueError("tapleaf_hash: script is required") raise ValueError("tapleaf_hash: script is required")
leaf = bytes([tapleaf_ver]) + serialize_varbytes(script) leaf = bytes([tapleaf_ver & 0xfe]) + serialize_varbytes(script)
return tagged_hash("TapLeaf", leaf) return tagged_hash("TapLeaf", leaf)