diff --git a/electrum/gui/qt/wizard/wallet.py b/electrum/gui/qt/wizard/wallet.py index 1fb2e7715..62f5be266 100644 --- a/electrum/gui/qt/wizard/wallet.py +++ b/electrum/gui/qt/wizard/wallet.py @@ -13,7 +13,7 @@ from PyQt5.QtWidgets import (QVBoxLayout, QHBoxLayout, QLabel, QLineEdit, QPushB from electrum.bip32 import is_bip32_derivation, BIP32Node, normalize_bip32_derivation, xpub_type from electrum.daemon import Daemon from electrum.i18n import _ -from electrum.keystore import bip44_derivation, bip39_to_seed, purpose48_derivation +from electrum.keystore import bip44_derivation, bip39_to_seed, purpose48_derivation, ScriptTypeNotSupported from electrum.plugin import run_hook, HardwarePluginLibraryUnavailable from electrum.storage import StorageReadWriteError from electrum.util import WalletFileException, get_new_wallet_name, UserCancelled @@ -1282,6 +1282,9 @@ class WCHWXPub(WizardComponent, Logger): t.start() def get_xpub_from_client(self, client, derivation, xtype): # override for HWW specific client if needed + _name, _info = self.wizard_data['hardware_device'] + if xtype not in self.plugin.SUPPORTED_XTYPES: + raise ScriptTypeNotSupported(_('This type of script is not supported with {}').format(_info.model_name)) return client.get_xpub(derivation, xtype) def validate(self): diff --git a/electrum/plugins/hw_wallet/plugin.py b/electrum/plugins/hw_wallet/plugin.py index 76c1bb34b..ca77d3959 100644 --- a/electrum/plugins/hw_wallet/plugin.py +++ b/electrum/plugins/hw_wallet/plugin.py @@ -44,6 +44,7 @@ if TYPE_CHECKING: class HW_PluginBase(BasePlugin): keystore_class: Type['Hardware_KeyStore'] libraries_available: bool + SUPPORTED_XTYPES = () # define supported library versions: minimum_library <= x < maximum_library minimum_library = (0,) diff --git a/electrum/plugins/trezor/qt.py b/electrum/plugins/trezor/qt.py index a46147039..c32584b14 100644 --- a/electrum/plugins/trezor/qt.py +++ b/electrum/plugins/trezor/qt.py @@ -11,6 +11,7 @@ from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QGridLayout, QPushButton, from electrum.i18n import _ from electrum.logging import Logger from electrum.plugin import hook +from electrum.keystore import ScriptTypeNotSupported from electrum.plugins.hw_wallet.qt import QtHandlerBase, QtPluginBase from electrum.plugins.hw_wallet.plugin import only_hook_if_libraries_available @@ -799,6 +800,9 @@ class WCTrezorXPub(WCHWXPub): WCHWXPub.__init__(self, parent, wizard) def get_xpub_from_client(self, client, derivation, xtype): + _name, _info = self.wizard_data['hardware_device'] + if xtype not in self.plugin.SUPPORTED_XTYPES: + raise ScriptTypeNotSupported(_('This type of script is not supported with {}').format(_info.model_name)) return client.get_xpub(derivation, xtype, True)