1
0
Fork 0
mirror of https://github.com/bitcoin/bips.git synced 2025-02-25 16:04:13 +01:00

Merge pull request #41 from dgpv/patch-1

taproot_output_script: first returned byte should be OP_1 (0x51)
This commit is contained in:
Pieter Wuille 2019-05-09 15:19:04 -07:00 committed by GitHub
commit b55fed9f86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -203,7 +203,7 @@ def taproot_output_script(internal_pubkey, script_tree):
t = tagged_hash("TapTweak", internal_pubkey.get_bytes() + h) t = tagged_hash("TapTweak", internal_pubkey.get_bytes() + h)
assert int.from_bytes(t, 'big') < SECP256K1_ORDER assert int.from_bytes(t, 'big') < SECP256K1_ORDER
output_pubkey = internal_pubkey.tweak_add(t).get_bytes() output_pubkey = internal_pubkey.tweak_add(t).get_bytes()
return bytes([0x01, 0x21, output_pubkey[0] & 1]) + output_pubkey[1:] return bytes([0x51, 0x21, output_pubkey[0] & 1]) + output_pubkey[1:]
</source> </source>
The function <code>taproot_output_script</code> returns a byte array with the scriptPubKey. It can be P2SH wrapped if desired (see BIP141). The function <code>taproot_output_script</code> returns a byte array with the scriptPubKey. It can be P2SH wrapped if desired (see BIP141).