1
0
Fork 0
mirror of https://github.com/bitcoin/bips.git synced 2025-02-26 00:14:27 +01:00

Merge pull request #63 from jonasnick/fix-sign-key

Fix privkey negation in taproot_sign_key
This commit is contained in:
Pieter Wuille 2019-08-29 17:47:24 -07:00 committed by GitHub
commit 51a84fd407
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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