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:
parent
e1f199989b
commit
02bdf88ef9
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user