summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Petukhov <dp@simplexum.com>2019-05-10 03:09:54 +0500
committerPieter Wuille <pieter.wuille@gmail.com>2020-01-19 14:47:33 -0800
commit953dd236650a02aa964049f138513b158463bea4 (patch)
tree68a8dfe2e0c962c56f9f55a521bc063e8720f0e6
parentb65cd694676096dd31ea790485a2019ca653b34f (diff)
taproot_output_script: first returned byte should be OP_1 (0x51)
If we look at def IsPayToTaproot(script): return len(script) == 35 and script[0] == OP_1 and script[1] == 33 and script[2] >= 0 and script[2] <= 1 First byte is is checked for OP_1. OP_1 is 0x51 But the example code in this BIP returns `bytes([0x01, 0x21, output_pubkey[0] & 1]) + output_pubkey[1:]` First byte 0x01, but it should be 0x51
-rw-r--r--bip-taproot.mediawiki2
1 files changed, 1 insertions, 1 deletions
diff --git a/bip-taproot.mediawiki b/bip-taproot.mediawiki
index 2e8b43b..0b6c04a 100644
--- a/bip-taproot.mediawiki
+++ b/bip-taproot.mediawiki
@@ -203,7 +203,7 @@ def taproot_output_script(internal_pubkey, script_tree):
t = tagged_hash("TapTweak", internal_pubkey.get_bytes() + h)
assert int.from_bytes(t, 'big') < SECP256K1_ORDER
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>
The function <code>taproot_output_script</code> returns a byte array with the scriptPubKey. It can be P2SH wrapped if desired (see BIP141).