cosigner pool: add warning when used with hardware wallet

related: #4271
This commit is contained in:
SomberNight 2018-04-17 16:20:08 +02:00
parent 624fa4769d
commit 95a93a3f86
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9

View file

@ -30,7 +30,7 @@ from PyQt5.QtGui import *
from PyQt5.QtCore import * from PyQt5.QtCore import *
from PyQt5.QtWidgets import QPushButton from PyQt5.QtWidgets import QPushButton
from electrum import bitcoin, util from electrum import bitcoin, util, keystore
from electrum import transaction from electrum import transaction
from electrum.plugins import BasePlugin, hook from electrum.plugins import BasePlugin, hook
from electrum.i18n import _ from electrum.i18n import _
@ -179,9 +179,10 @@ class Plugin(BasePlugin):
server.put(_hash, message) server.put(_hash, message)
except Exception as e: except Exception as e:
traceback.print_exc(file=sys.stdout) traceback.print_exc(file=sys.stdout)
window.show_message("Failed to send transaction to cosigning pool.") window.show_message(_("Failed to send transaction to cosigning pool."))
return return
window.show_message("Your transaction was sent to the cosigning pool.\nOpen your cosigner wallet to retrieve it.") window.show_message(_("Your transaction was sent to the cosigning pool.") + '\n' +
_("Open your cosigner wallet to retrieve it."))
def on_receive(self, keyhash, message): def on_receive(self, keyhash, message):
self.print_error("signal arrived for", keyhash) self.print_error("signal arrived for", keyhash)
@ -193,13 +194,20 @@ class Plugin(BasePlugin):
return return
wallet = window.wallet wallet = window.wallet
if wallet.has_keystore_encryption(): if isinstance(wallet.keystore, keystore.Hardware_KeyStore):
password = window.password_dialog('An encrypted transaction was retrieved from cosigning pool.\nPlease enter your password to decrypt it.') window.show_warning(_('An encrypted transaction was retrieved from cosigning pool.') + '\n' +
_('However, hardware wallets do not support message decryption, '
'which makes them not compatible with the current design of cosigner pool.'))
return
elif wallet.has_keystore_encryption():
password = window.password_dialog(_('An encrypted transaction was retrieved from cosigning pool.') + '\n' +
_('Please enter your password to decrypt it.'))
if not password: if not password:
return return
else: else:
password = None password = None
if not window.question(_("An encrypted transaction was retrieved from cosigning pool.\nDo you want to open it now?")): if not window.question(_("An encrypted transaction was retrieved from cosigning pool.") + '\n' +
_("Do you want to open it now?")):
return return
xprv = wallet.keystore.get_master_private_key(password) xprv = wallet.keystore.get_master_private_key(password)