mirror of
https://github.com/bitcoin/bips.git
synced 2025-02-26 08:59:43 +01:00
Merge pull request #63 from jonasnick/fix-sign-key
Fix privkey negation in taproot_sign_key
This commit is contained in:
commit
51a84fd407
1 changed files with 3 additions and 3 deletions
|
@ -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…
Add table
Reference in a new issue