1
0

bitcoin.py: rm bip340_tagged_hash (duplicated from electrum_ecc)

This commit is contained in:
SomberNight
2025-03-01 18:18:52 +00:00
parent fc093f8a93
commit 0a093754d7
3 changed files with 6 additions and 9 deletions

View File

@@ -28,6 +28,7 @@ import enum
from enum import IntEnum, Enum
import electrum_ecc as ecc
from electrum_ecc.util import bip340_tagged_hash
from .util import bfh, BitcoinException, assert_bytes, to_bytes, inv_dict, is_hex_str, classproperty
from . import segwit_addr
@@ -813,12 +814,6 @@ TapTreeLeaf = Tuple[int, bytes]
TapTree = Union[TapTreeLeaf, Sequence['TapTree']]
# FIXME just use electrum_ecc.util.bip340_tagged_hash instead
def bip340_tagged_hash(tag: bytes, msg: bytes) -> bytes:
# note: _libsecp256k1.secp256k1_tagged_sha256 benchmarks about 70% slower than this (on my machine)
return sha256(sha256(tag) + sha256(tag) + msg)
def taproot_tree_helper(script_tree: TapTree):
if isinstance(script_tree, tuple):
leaf_version, script = script_tree