Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions electrum/hw_wallet/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def stop(self):
def show_message(self, msg, on_cancel=None):
print_stderr(msg)

def show_warning(self, msg, blocking=False):
print_stderr(msg)

def show_error(self, msg, blocking=False):
print_stderr(msg)

Expand Down
3 changes: 3 additions & 0 deletions electrum/hw_wallet/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ def yes_no_question(self, msg: str) -> bool:
def show_message(self, msg: str, on_cancel=None) -> None:
raise NotImplementedError()

def show_warning(self, msg: str, blocking: bool = False) -> None:
raise NotImplementedError()

def show_error(self, msg: str, blocking: bool = False) -> None:
raise NotImplementedError()

Expand Down
13 changes: 13 additions & 0 deletions electrum/hw_wallet/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class QtHandlerBase(HardwareHandlerBase, QObject, Logger):

passphrase_signal = pyqtSignal(object, object)
message_signal = pyqtSignal(object, object)
warning_signal = pyqtSignal(object, object)
error_signal = pyqtSignal(object, object)
word_signal = pyqtSignal(object)
clear_signal = pyqtSignal()
Expand All @@ -75,6 +76,7 @@ def __init__(self, win: Union['ElectrumWindow', 'QENewWalletWizard'], device: st
assert win.gui_thread == threading.current_thread(), 'must be called from GUI thread'
self.clear_signal.connect(self.clear_dialog)
self.error_signal.connect(self.error_dialog)
self.warning_signal.connect(self.warning_dialog)
self.message_signal.connect(self.message_dialog)
self.passphrase_signal.connect(self.passphrase_dialog)
self.word_signal.connect(self.word_dialog)
Expand Down Expand Up @@ -116,6 +118,12 @@ def yes_no_question(self, msg):
def show_message(self, msg, on_cancel=None):
self.message_signal.emit(msg, on_cancel)

def show_warning(self, msg, blocking=False):
self.done.clear()
self.warning_signal.emit(msg, blocking)
if blocking:
self.done.wait()

def show_error(self, msg, blocking=False):
self.done.clear()
self.error_signal.emit(msg, blocking)
Expand Down Expand Up @@ -201,6 +209,11 @@ def message_dialog(self, msg, on_cancel=None):
vbox.addLayout(Buttons(CancelButton(dialog)))
dialog.show()

def warning_dialog(self, msg, blocking):
self.win.show_warning(msg, parent=self.top_level_window())
if blocking:
self.done.set()

def error_dialog(self, msg, blocking):
self.win.show_error(msg, parent=self.top_level_window())
if blocking:
Expand Down
34 changes: 23 additions & 11 deletions electrum/plugins/digitalbitbox/digitalbitbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def derive_keys(x):

ENCRYPTION_PRIVKEY_KEY = 'encryptionprivkey'
CHANNEL_ID_KEY = 'comserverchannelid'

DEPRECATION_WARNING_SHOWN = False

class DigitalBitbox_Client(HardwareClientBase):
def __init__(self, plugin, hidDevice):
Expand Down Expand Up @@ -125,18 +125,30 @@ def get_xpub(self, bip32_path, xtype):
raise UserFacingException(_('This device does not reveal xpubs corresponding to non-hardened paths'))

reply = self._get_xpub(bip32_path)
if reply:
xpub = reply['xpub']
# Change type of xpub to the requested type. The firmware
# only ever returns the mainnet standard type, but it is agnostic
# to the type when signing.
if xtype != 'standard' or constants.net.TESTNET:
node = BIP32Node.from_xkey(xpub, net=constants.BitcoinMainnet)
xpub = node._replace(xtype=xtype).to_xpub()
return xpub
else:
if not reply:
raise Exception('no reply')

xpub = reply['xpub']
# Change type of xpub to the requested type. The firmware
# only ever returns the mainnet standard type, but it is agnostic
# to the type when signing.
if xtype != 'standard' or constants.net.TESTNET:
node = BIP32Node.from_xkey(xpub, net=constants.BitcoinMainnet)
xpub = node._replace(xtype=xtype).to_xpub()

deprecation_warning = (
"DigitalBitbox (BitBox01) is being deprecated.\n\nIt is no longer supported by the manufacturer.\n"
"Future versions of Electrum will no longer be compatible with it.\n\n"
"You should move your coins and migrate to a modern hardware device.")
_logger.warning(deprecation_warning.replace("\n", " "))

global DEPRECATION_WARNING_SHOWN
if self.handler and not DEPRECATION_WARNING_SHOWN:
DEPRECATION_WARNING_SHOWN = True
self.handler.show_warning(deprecation_warning, blocking=True)
Comment on lines +139 to +148

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe only show this once per process lifecycle?
You could declare a global DEPRECATION_WARNING_SHOWN = False at the top, and set it to true here.


return xpub

def get_soft_device_id(self):
return None

Expand Down
15 changes: 15 additions & 0 deletions electrum/plugins/safe_t/clientbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
from electrum.hw_wallet.plugin import HardwareClientBase, HardwareHandlerBase


DEPRECATION_WARNING_SHOWN = False


class GuiMixin(object):
# Requires: self.proto, self.device
handler: Optional[HardwareHandlerBase]
Expand Down Expand Up @@ -175,6 +178,18 @@ def get_xpub(self, bip32_path, xtype):
address_n = self.expand_path(bip32_path)
creating = False
node = self.get_public_node(address_n, creating).node

deprecation_warning = (
"Archos Safe-T mini is being deprecated.\n\nIt is no longer supported by the manufacturer.\n"
"Future versions of Electrum will no longer be compatible with it.\n\n"
"You should move your coins and migrate to a modern hardware device.")
self.logger.warning(deprecation_warning.replace("\n", " "))

global DEPRECATION_WARNING_SHOWN
if self.handler and not DEPRECATION_WARNING_SHOWN:
DEPRECATION_WARNING_SHOWN = True
self.handler.show_warning(deprecation_warning, blocking=True)

return BIP32Node(xtype=xtype,
eckey=ecc.ECPubkey(node.public_key),
chaincode=node.chain_code,
Expand Down