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:
parent
63295ae478
commit
fcaa3343e2
1
core/.changelog.d/4159.added
Normal file
1
core/.changelog.d/4159.added
Normal file
@ -0,0 +1 @@
|
|||||||
|
Taproot Multisig send and spend
|
@ -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.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -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(
|
||||||
|
@ -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']}"
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user