Skip to content

Commit 194ee73

Browse files
authored
Merge pull request bitcoin#1369 from DariusParvin/bip341
BIP 341: add missing conversions between bytes and int
2 parents 40aef27 + 3cdfe1b commit 194ee73

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

bip-0341.mediawiki

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,13 @@ def taproot_tweak_pubkey(pubkey, h):
186186
return 0 if has_even_y(Q) else 1, bytes_from_int(x(Q))
187187

188188
def taproot_tweak_seckey(seckey0, h):
189-
P = point_mul(G, int_from_bytes(seckey0))
189+
seckey0 = int_from_bytes(seckey0)
190+
P = point_mul(G, seckey0)
190191
seckey = seckey0 if has_even_y(P) else SECP256K1_ORDER - seckey0
191192
t = int_from_bytes(tagged_hash("TapTweak", bytes_from_int(x(P)) + h))
192193
if t >= SECP256K1_ORDER:
193194
raise ValueError
194-
return (seckey + t) % SECP256K1_ORDER
195+
return bytes_from_int((seckey + t) % SECP256K1_ORDER)
195196
</source>
196197

197198
The following function, <code>taproot_output_script</code>, returns a byte array with the scriptPubKey (see [[bip-0141.mediawiki|BIP141]]).
@@ -350,6 +351,6 @@ Depending on the implementation non-upgraded wallets may be able to send to Segw
350351

351352
== Acknowledgements ==
352353

353-
This document is the result of discussions around script and signature improvements with many people, and had direct contributions from Greg Maxwell and others. It further builds on top of earlier published proposals such as Taproot by Greg Maxwell, and Merkle branch constructions by Russell O'Connor, Johnson Lau, and Mark Friedenbach.
354+
This document is the result of discussions around script and signature improvements with many people, and had direct contributions from Greg Maxwell and others. It further builds on top of earlier published proposals such as Taproot by Greg Maxwell, and Merkle branch constructions by Russell O'Connor, Johnson Lau, and Mark Friedenbach.
354355

355356
The authors wish the thank Arik Sosman for suggesting to sort Merkle node children before hashes, removing the need to transfer the position in the tree, as well as all those who provided valuable feedback and reviews, including the participants of the [https://github.com/ajtowns/taproot-review structured reviews].

0 commit comments

Comments
 (0)