mirror of
https://github.com/bitcoin/bips.git
synced 2025-05-12 12:03:29 +00:00
Merge pull request #1109 from Crypt-iQ/tuple_fix_04232021
BIP 341: fix tuple index in taproot_tweak_pubkey
This commit is contained in:
commit
fb6930cc1d
@ -173,7 +173,7 @@ First, we define <code>taproot_tweak_pubkey</code> for 32-byte [[bip-0340.mediaw
|
||||
The function returns a bit indicating the tweaked public key's Y coordinate as well as the public key byte array.
|
||||
The parity bit will be required for spending the output with a script path.
|
||||
In order to allow spending with the key path, we define <code>taproot_tweak_seckey</code> to compute the secret key for a tweaked public key.
|
||||
For any byte string <code>h</code> it holds that <code>taproot_tweak_pubkey(pubkey_gen(seckey), h)[0] == pubkey_gen(taproot_tweak_seckey(seckey, h))</code>.
|
||||
For any byte string <code>h</code> it holds that <code>taproot_tweak_pubkey(pubkey_gen(seckey), h)[1] == pubkey_gen(taproot_tweak_seckey(seckey, h))</code>.
|
||||
|
||||
<source lang="python">
|
||||
def taproot_tweak_pubkey(pubkey, h):
|
||||
@ -219,7 +219,7 @@ def taproot_output_script(internal_pubkey, script_tree):
|
||||
h = bytes()
|
||||
else:
|
||||
_, h = taproot_tree_helper(script_tree)
|
||||
output_pubkey, _ = taproot_tweak_pubkey(internal_pubkey, h)
|
||||
_, output_pubkey = taproot_tweak_pubkey(internal_pubkey, h)
|
||||
return bytes([0x51, 0x20]) + output_pubkey
|
||||
</source>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user