mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-27 01:48:17 +00:00
core/bitcoin: Move BIP32_WALLET_DEPTH to common.
This commit is contained in:
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.
|
# Default signature hash type in Bitcoin which signs all inputs and all outputs of the transaction.
|
||||||
SIGHASH_ALL = const(0x01)
|
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
|
# supported witness version for bech32 addresses
|
||||||
_BECH32_WITVER = const(0x00)
|
_BECH32_WITVER = const(0x00)
|
||||||
|
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
from micropython import const
|
|
||||||
|
|
||||||
from trezor import wire
|
from trezor import wire
|
||||||
from trezor.messages.TxInputType import TxInputType
|
from trezor.messages.TxInputType import TxInputType
|
||||||
from trezor.messages.TxOutputType import TxOutputType
|
from trezor.messages.TxOutputType import TxOutputType
|
||||||
from trezor.utils import ensure
|
from trezor.utils import ensure
|
||||||
|
|
||||||
from .. import multisig
|
from .. import multisig
|
||||||
|
from ..common import BIP32_WALLET_DEPTH
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
from typing import Any, Union
|
from typing import Any, Union
|
||||||
|
|
||||||
# the number of bip32 levels used in a wallet (chain and address)
|
|
||||||
_BIP32_WALLET_DEPTH = const(2)
|
|
||||||
|
|
||||||
|
|
||||||
class MatchChecker:
|
class MatchChecker:
|
||||||
"""
|
"""
|
||||||
@ -85,7 +81,7 @@ class WalletPathChecker(MatchChecker):
|
|||||||
def attribute_from_tx(self, txio: Union[TxInputType, TxOutputType]) -> Any:
|
def attribute_from_tx(self, txio: Union[TxInputType, TxOutputType]) -> Any:
|
||||||
if not txio.address_n:
|
if not txio.address_n:
|
||||||
return None
|
return None
|
||||||
return txio.address_n[:-_BIP32_WALLET_DEPTH]
|
return txio.address_n[:-BIP32_WALLET_DEPTH]
|
||||||
|
|
||||||
|
|
||||||
class MultisigFingerprintChecker(MatchChecker):
|
class MultisigFingerprintChecker(MatchChecker):
|
||||||
|
Loading…
Reference in New Issue
Block a user