core/bitcoin: Move BIP32_WALLET_DEPTH to common.

pull/1168/head
Andrew Kozlik 4 years ago committed by Andrew Kozlik
parent bbab13f6e7
commit dc32a17335

@ -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)

@ -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):

Loading…
Cancel
Save