diff --git a/core/src/apps/bitcoin/common.py b/core/src/apps/bitcoin/common.py index d9b7bf00b..842647c78 100644 --- a/core/src/apps/bitcoin/common.py +++ b/core/src/apps/bitcoin/common.py @@ -18,6 +18,9 @@ BITCOIN_NAMES = ("Bitcoin", "Regtest", "Testnet") # Default signature hash type in Bitcoin which signs all inputs and all outputs of the transaction. SIGHASH_ALL = const(0x01) +# The number of bip32 levels used in a wallet (chain and address) +BIP32_WALLET_DEPTH = const(2) + # supported witness version for bech32 addresses _BECH32_WITVER = const(0x00) diff --git a/core/src/apps/bitcoin/sign_tx/matchcheck.py b/core/src/apps/bitcoin/sign_tx/matchcheck.py index 336296b12..48c8590d7 100644 --- a/core/src/apps/bitcoin/sign_tx/matchcheck.py +++ b/core/src/apps/bitcoin/sign_tx/matchcheck.py @@ -1,18 +1,14 @@ -from micropython import const - from trezor import wire from trezor.messages.TxInputType import TxInputType from trezor.messages.TxOutputType import TxOutputType from trezor.utils import ensure from .. import multisig +from ..common import BIP32_WALLET_DEPTH if False: from typing import Any, Union -# the number of bip32 levels used in a wallet (chain and address) -_BIP32_WALLET_DEPTH = const(2) - class MatchChecker: """ @@ -85,7 +81,7 @@ class WalletPathChecker(MatchChecker): def attribute_from_tx(self, txio: Union[TxInputType, TxOutputType]) -> Any: if not txio.address_n: return None - return txio.address_n[:-_BIP32_WALLET_DEPTH] + return txio.address_n[:-BIP32_WALLET_DEPTH] class MultisigFingerprintChecker(MatchChecker):