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

fix(core): In apps.bitcoin ensure that get_address() fails for multisig if user's public key is not included.

(cherry picked from commit 77f5e90466)
This commit is contained in:
Andrew Kozlik 2020-10-26 16:20:59 +01:00 committed by Tomas Susanka
parent 391602ae99
commit 78a2ff16d4

View File

@ -23,16 +23,15 @@ def get_address(
node: bip32.HDNode, node: bip32.HDNode,
multisig: MultisigRedeemScriptType = None, multisig: MultisigRedeemScriptType = None,
) -> str: ) -> str:
if multisig:
# Ensure that our public key is included in the multisig.
multisig_pubkey_index(multisig, node.public_key())
if ( if (
script_type == InputScriptType.SPENDADDRESS script_type == InputScriptType.SPENDADDRESS
or script_type == InputScriptType.SPENDMULTISIG or script_type == InputScriptType.SPENDMULTISIG
): ):
if multisig: # p2sh multisig if multisig: # p2sh multisig
pubkey = node.public_key()
index = multisig_pubkey_index(multisig, pubkey)
if index is None:
raise wire.ProcessError("Public key not found")
if coin.address_type_p2sh is None: if coin.address_type_p2sh is None:
raise wire.ProcessError("Multisig not enabled on this coin") raise wire.ProcessError("Multisig not enabled on this coin")