Skip to content

Commit

Permalink
Merge pull request bitcoin#1386 from jonasnick/fix-taproot-tweak-pubkey
Browse files Browse the repository at this point in the history
BIP 341: Fix taproot_tweak_pubkey
  • Loading branch information
kallewoof authored Jan 4, 2023
2 parents 15c8203 + be34027 commit c672558
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bip-0341.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ def taproot_tweak_pubkey(pubkey, h):
t = int_from_bytes(tagged_hash("TapTweak", pubkey + h))
if t >= SECP256K1_ORDER:
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))

def taproot_tweak_seckey(seckey0, h):
Expand Down

0 comments on commit c672558

Please sign in to comment.