mirror of
https://github.com/bitcoin/bips.git
synced 2025-06-21 14:22:28 +02:00
Merge pull request #1386 from jonasnick/fix-taproot-tweak-pubkey
BIP 341: Fix taproot_tweak_pubkey
This commit is contained in:
commit
c6725580c5
@ -182,7 +182,10 @@ def taproot_tweak_pubkey(pubkey, h):
|
|||||||
t = int_from_bytes(tagged_hash("TapTweak", pubkey + h))
|
t = int_from_bytes(tagged_hash("TapTweak", pubkey + h))
|
||||||
if t >= SECP256K1_ORDER:
|
if t >= SECP256K1_ORDER:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
Q = point_add(lift_x(int(pubkey)), point_mul(G, t))
|
P = lift_x(int_from_bytes(pubkey))
|
||||||
|
if P is None:
|
||||||
|
raise ValueError
|
||||||
|
Q = point_add(P, point_mul(G, t))
|
||||||
return 0 if has_even_y(Q) else 1, bytes_from_int(x(Q))
|
return 0 if has_even_y(Q) else 1, bytes_from_int(x(Q))
|
||||||
|
|
||||||
def taproot_tweak_seckey(seckey0, h):
|
def taproot_tweak_seckey(seckey0, h):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user