1
0

hw wallets: define SUPPORTED_XTYPES for each plugin

This commit is contained in:
SomberNight
2018-05-09 18:17:49 +02:00
parent dc2f8ee804
commit c133e00590
4 changed files with 15 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ from electrum.i18n import _
from electrum.plugins import BasePlugin, Device
from electrum.transaction import deserialize, Transaction
from electrum.keystore import Hardware_KeyStore, is_xpubkey, parse_xpubkey, xtype_from_derivation
from electrum.base_wizard import ScriptTypeNotSupported
from ..hw_wallet import HW_PluginBase
@@ -85,6 +86,7 @@ class TrezorPlugin(HW_PluginBase):
minimum_firmware = (1, 5, 2)
keystore_class = TrezorKeyStore
minimum_library = (0, 9, 0)
SUPPORTED_XTYPES = ('standard', 'p2wpkh-p2sh', 'p2wpkh', 'p2wsh-p2sh', 'p2wsh')
MAX_LABEL_LEN = 32
@@ -263,6 +265,8 @@ class TrezorPlugin(HW_PluginBase):
client.used()
def get_xpub(self, device_id, derivation, xtype, wizard):
if xtype not in self.SUPPORTED_XTYPES:
raise ScriptTypeNotSupported(_('This type of script is not supported with {}.').format(self.device))
devmgr = self.device_manager()
client = devmgr.client_by_id(device_id)
client.handler = wizard