commit a7cfa56621b5a98279859cdc4874512be7b77999
parent 9228cb5b8ed06317fe51a3e21708c0ba95e0e115
Author: SomberNight <somber.night@protonmail.com>
Date: Fri, 3 Aug 2018 20:53:56 +0200
cosigner pool: don't block gui
Diffstat:
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/electrum/plugins/cosigner_pool/qt.py b/electrum/plugins/cosigner_pool/qt.py
@@ -38,6 +38,7 @@ from electrum.wallet import Multisig_Wallet
from electrum.util import bh2u, bfh
from electrum.gui.qt.transaction_dialog import show_transaction
+from electrum.gui.qt.util import WaitingDialog
import sys
import traceback
@@ -170,20 +171,26 @@ class Plugin(BasePlugin):
return cosigner_xpub in xpub_set
def do_send(self, tx):
+ def on_success(result):
+ window.show_message(_("Your transaction was sent to the cosigning pool.") + '\n' +
+ _("Open your cosigner wallet to retrieve it."))
+ def on_failure(exc_info):
+ e = exc_info[1]
+ try: traceback.print_exception(*exc_info)
+ except OSError: pass
+ window.show_error(_("Failed to send transaction to cosigning pool") + ':\n' + str(e))
+
for window, xpub, K, _hash in self.cosigner_list:
if not self.cosigner_can_sign(tx, xpub):
continue
+ # construct message
raw_tx_bytes = bfh(str(tx))
public_key = ecc.ECPubkey(K)
message = public_key.encrypt_message(raw_tx_bytes).decode('ascii')
- try:
- server.put(_hash, message)
- except Exception as e:
- traceback.print_exc(file=sys.stdout)
- window.show_error(_("Failed to send transaction to cosigning pool") + ':\n' + str(e))
- return
- window.show_message(_("Your transaction was sent to the cosigning pool.") + '\n' +
- _("Open your cosigner wallet to retrieve it."))
+ # send message
+ task = lambda: server.put(_hash, message)
+ msg = _('Sending transaction to cosigning pool...')
+ WaitingDialog(window, msg, task, on_success, on_failure)
def on_receive(self, keyhash, message):
self.print_error("signal arrived for", keyhash)