1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-02 04:18:20 +00:00

fix: taproot multisig

This commit is contained in:
Pavol Rusnak 2024-09-16 15:46:15 +02:00 committed by Andrew Toth
parent 63295ae478
commit fcaa3343e2
No known key found for this signature in database
GPG Key ID: 60007AFC8938B018
4 changed files with 5 additions and 2 deletions

View File

@ -0,0 +1 @@
Taproot Multisig send and spend

View File

@ -45,9 +45,10 @@ def verify(public_key: bytes, signature: bytes, digest: bytes) -> bool:
def tweak_public_key( def tweak_public_key(
public_key: bytes, public_key: bytes,
root_hash: bytes | None = None, root_hash: bytes | None = None,
) -> bytes: ) -> tuple[int, bytes]:
""" """
Tweaks the public key with the specified root_hash. Tweaks the public key with the specified root_hash.
First element of tuple is the parity, second is the tweaked public key.
""" """

View File

@ -551,6 +551,7 @@ class Bitcoin:
i, i,
tx_info.tx, tx_info.tx,
self.get_sighash_type(txi), self.get_sighash_type(txi),
None,
) )
else: else:
return tx_info.sig_hasher.hash143( return tx_info.sig_hasher.hash143(

View File

@ -278,7 +278,7 @@ class TestSegwitBip341P2TR(unittest.TestCase):
for sh in tx["signature_hashes"]: for sh in tx["signature_hashes"]:
txi = tx["inputs"][sh["index"]] txi = tx["inputs"][sh["index"]]
result = hasher.hash341(sh["index"], tx["sign_tx"], sh["hash_type"]) result = hasher.hash341(sh["index"], tx["sign_tx"], sh["hash_type"], None)
self.assertEqual( self.assertEqual(
result, sh["result"], f"signature_hash tx {i} input {sh['index']}" result, sh["result"], f"signature_hash tx {i} input {sh['index']}"
) )