1
0
mirror of https://github.com/bitcoin/bips.git synced 2025-05-12 12:03:29 +00:00

Merge pull request #1350 from jonasnick/bip-0341-signingfix

BIP 341: allow taproot_sign_key with no script tree
This commit is contained in:
kallewoof 2023-01-05 08:43:37 +09:00 committed by GitHub
commit 00902d17d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -249,7 +249,10 @@ TapTweak = tagged_hash("TapTweak", p + ABCDE)
<source lang="python"> <source lang="python">
def taproot_sign_key(script_tree, internal_seckey, hash_type, bip340_aux_rand): def taproot_sign_key(script_tree, internal_seckey, hash_type, bip340_aux_rand):
_, h = taproot_tree_helper(script_tree) if script_tree is None:
h = bytes()
else:
_, h = taproot_tree_helper(script_tree)
output_seckey = taproot_tweak_seckey(internal_seckey, h) output_seckey = taproot_tweak_seckey(internal_seckey, h)
sig = schnorr_sign(sighash(hash_type), output_seckey, bip340_aux_rand) sig = schnorr_sign(sighash(hash_type), output_seckey, bip340_aux_rand)
if hash_type != 0: if hash_type != 0: