summaryrefslogtreecommitdiff
path: root/bip-taproot.mediawiki
diff options
context:
space:
mode:
authorJonas Nick <jonasd.nick@gmail.com>2019-08-29 20:46:47 +0000
committerPieter Wuille <pieter.wuille@gmail.com>2020-01-19 14:47:33 -0800
commit8fd629c3f9c94c48b3d049ec50d1cbba22b02d3c (patch)
tree608216c6226930e2ced2e73c104710755101a341 /bip-taproot.mediawiki
parentcc962bf84f44a1ac07bdb8c269aee07abde551d4 (diff)
downloadbips-8fd629c3f9c94c48b3d049ec50d1cbba22b02d3c.tar.xz
Fix privkey negation in taproot_sign_key
Diffstat (limited to 'bip-taproot.mediawiki')
-rw-r--r--bip-taproot.mediawiki4
1 files changed, 2 insertions, 2 deletions
diff --git a/bip-taproot.mediawiki b/bip-taproot.mediawiki
index 769f13d..d720be1 100644
--- a/bip-taproot.mediawiki
+++ b/bip-taproot.mediawiki
@@ -200,10 +200,10 @@ See the code below:
<source lang="python">
def taproot_sign_key(script_tree, internal_privkey, hash_type):
+ _, h = taproot_tree_helper(script_tree)
internal_pubkey, is_y_qresidue = internal_privkey.pubkey_gen()
- if is_y_qresidue:
+ if not is_y_qresidue:
internal_privkey = internal_privkey.negate()
- _, h = taproot_tree_helper(script_tree)
t = tagged_hash("TapTweak", internal_pubkey.get_bytes() + h)
output_privkey = internal_privkey.tweak_add(t)
sig = output_privkey.schnorr_sign(sighash(hash_type))