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:
@@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user