1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-11 08:58:08 +00:00

fix(core): make sorting of pubkeys fully deterministic

This commit is contained in:
Ondřej Vejpustek 2024-11-12 14:07:56 +01:00
parent 8e6a00449c
commit 55786e7289

View File

@ -28,8 +28,7 @@ def multisig_fingerprint(multisig: MultisigRedeemScriptType) -> bytes:
if len(d.public_key) != 33 or len(d.chain_code) != 32:
raise DataError("Invalid multisig parameters")
# casting to bytes(), sorting on bytearray() is not supported in MicroPython
pubnodes = sorted(pubnodes, key=lambda n: bytes(n.public_key))
pubnodes = sorted(pubnodes, key=lambda n: n.public_key + n.chain_code)
h = HashWriter(sha256())
write_uint32(h, m)