|
|
@ -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) |
|
|
|