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

core/bitcoin: Move BIP32_WALLET_DEPTH to common.

This commit is contained in:
Andrew Kozlik 2020-06-30 09:01:05 +02:00 committed by Andrew Kozlik
parent bbab13f6e7
commit dc32a17335
2 changed files with 5 additions and 6 deletions

View File

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

View File

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