From 53b5d6262319d23b9f30714ded4afc69f570956b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Vejpustek?= Date: Tue, 12 Nov 2024 14:07:56 +0100 Subject: [PATCH] fix(core): make sorting of pubkeys fully deterministic --- core/src/apps/bitcoin/multisig.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/apps/bitcoin/multisig.py b/core/src/apps/bitcoin/multisig.py index a26252a253..8ac1b7a1e5 100644 --- a/core/src/apps/bitcoin/multisig.py +++ b/core/src/apps/bitcoin/multisig.py @@ -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)