Skip to content

Commit c672558

Browse files
authored
Merge pull request bitcoin#1386 from jonasnick/fix-taproot-tweak-pubkey
BIP 341: Fix taproot_tweak_pubkey
2 parents 15c8203 + be34027 commit c672558

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bip-0341.mediawiki

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ def taproot_tweak_pubkey(pubkey, h):
182182
t = int_from_bytes(tagged_hash("TapTweak", pubkey + h))
183183
if t >= SECP256K1_ORDER:
184184
raise ValueError
185-
Q = point_add(lift_x(int(pubkey)), point_mul(G, t))
185+
P = lift_x(int_from_bytes(pubkey))
186+
if P is None:
187+
raise ValueError
188+
Q = point_add(P, point_mul(G, t))
186189
return 0 if has_even_y(Q) else 1, bytes_from_int(x(Q))
187190

188191
def taproot_tweak_seckey(seckey0, h):

0 commit comments

Comments
 (0)