From 6689b9c22fb3231149d405945ed601bf9c9dd16b Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 13 Jan 2021 22:55:50 +0100 Subject: [PATCH] common/protob: add GetAddress.ignore_xpub_magic field --- common/protob/messages-bitcoin.proto | 1 + core/src/trezor/messages/GetAddress.py | 3 +++ python/src/trezorlib/btc.py | 2 ++ python/src/trezorlib/messages/GetAddress.py | 3 +++ 4 files changed, 9 insertions(+) diff --git a/common/protob/messages-bitcoin.proto b/common/protob/messages-bitcoin.proto index 877b83a83c..eb97e409d5 100644 --- a/common/protob/messages-bitcoin.proto +++ b/common/protob/messages-bitcoin.proto @@ -87,6 +87,7 @@ message GetAddress { optional bool show_display = 3; // optionally show on display before sending the result optional MultisigRedeemScriptType multisig = 4; // filled if we are showing a multisig address optional InputScriptType script_type = 5 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.) + optional bool ignore_xpub_magic = 6; // ignore SLIP-0132 XPUB magic, use xpub/tpub prefix for all account types } /** diff --git a/core/src/trezor/messages/GetAddress.py b/core/src/trezor/messages/GetAddress.py index 8931593a70..9883121549 100644 --- a/core/src/trezor/messages/GetAddress.py +++ b/core/src/trezor/messages/GetAddress.py @@ -24,12 +24,14 @@ class GetAddress(p.MessageType): show_display: bool = None, multisig: MultisigRedeemScriptType = None, script_type: EnumTypeInputScriptType = 0, + ignore_xpub_magic: bool = None, ) -> None: self.address_n = address_n if address_n is not None else [] self.coin_name = coin_name self.show_display = show_display self.multisig = multisig self.script_type = script_type + self.ignore_xpub_magic = ignore_xpub_magic @classmethod def get_fields(cls) -> Dict: @@ -39,4 +41,5 @@ class GetAddress(p.MessageType): 3: ('show_display', p.BoolType, None), 4: ('multisig', MultisigRedeemScriptType, None), 5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS + 6: ('ignore_xpub_magic', p.BoolType, None), } diff --git a/python/src/trezorlib/btc.py b/python/src/trezorlib/btc.py index 1afd95a0e1..775dcf7678 100644 --- a/python/src/trezorlib/btc.py +++ b/python/src/trezorlib/btc.py @@ -88,6 +88,7 @@ def get_address( show_display=False, multisig=None, script_type=messages.InputScriptType.SPENDADDRESS, + ignore_xpub_magic=False, ): return client.call( messages.GetAddress( @@ -96,6 +97,7 @@ def get_address( show_display=show_display, multisig=multisig, script_type=script_type, + ignore_xpub_magic=ignore_xpub_magic, ) ) diff --git a/python/src/trezorlib/messages/GetAddress.py b/python/src/trezorlib/messages/GetAddress.py index b77946a429..03d6cc531b 100644 --- a/python/src/trezorlib/messages/GetAddress.py +++ b/python/src/trezorlib/messages/GetAddress.py @@ -24,12 +24,14 @@ class GetAddress(p.MessageType): show_display: bool = None, multisig: MultisigRedeemScriptType = None, script_type: EnumTypeInputScriptType = 0, + ignore_xpub_magic: bool = None, ) -> None: self.address_n = address_n if address_n is not None else [] self.coin_name = coin_name self.show_display = show_display self.multisig = multisig self.script_type = script_type + self.ignore_xpub_magic = ignore_xpub_magic @classmethod def get_fields(cls) -> Dict: @@ -39,4 +41,5 @@ class GetAddress(p.MessageType): 3: ('show_display', p.BoolType, None), 4: ('multisig', MultisigRedeemScriptType, None), 5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS + 6: ('ignore_xpub_magic', p.BoolType, None), }