1
0
mirror of https://github.com/bitcoin/bips.git synced 2024-11-20 10:11:46 +01:00

Fix privkey negation in taproot_sign_key

This commit is contained in:
Jonas Nick 2019-08-29 20:46:47 +00:00
parent e1f199989b
commit 02bdf88ef9

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))