1
0
Fork 0
mirror of https://github.com/bitcoin/bips.git synced 2025-03-13 19:16:49 +01:00

Fix privkey negation in taproot_sign_key

This commit is contained in:
Jonas Nick 2019-08-29 20:46:47 +00:00 committed by Pieter Wuille
parent cc962bf84f
commit 8fd629c3f9

View file

@ -200,10 +200,10 @@ See the code below:
<source lang="python">
def taproot_sign_key(script_tree, internal_privkey, hash_type):
internal_pubkey, is_y_qresidue = internal_privkey.pubkey_gen()
if is_y_qresidue:
internal_privkey = internal_privkey.negate()
_, h = taproot_tree_helper(script_tree)
internal_pubkey, is_y_qresidue = internal_privkey.pubkey_gen()
if not is_y_qresidue:
internal_privkey = internal_privkey.negate()
t = tagged_hash("TapTweak", internal_pubkey.get_bytes() + h)
output_privkey = internal_privkey.tweak_add(t)
sig = output_privkey.schnorr_sign(sighash(hash_type))