catch exception within sign thread, to re-enable send button
This commit is contained in:
parent
55770a93bf
commit
2da9a02fb3
|
@ -1021,13 +1021,15 @@ class ElectrumWindow(QMainWindow):
|
||||||
|
|
||||||
# sign the tx
|
# sign the tx
|
||||||
def sign_thread():
|
def sign_thread():
|
||||||
time.sleep(0.1)
|
|
||||||
keypairs = {}
|
keypairs = {}
|
||||||
self.wallet.add_keypairs(tx, keypairs, password)
|
try:
|
||||||
self.wallet.sign_transaction(tx, keypairs, password)
|
self.wallet.add_keypairs(tx, keypairs, password)
|
||||||
return tx, fee, label
|
self.wallet.sign_transaction(tx, keypairs, password)
|
||||||
|
except Exception as e:
|
||||||
|
tx.error = str(e)
|
||||||
|
return tx
|
||||||
|
|
||||||
def sign_done(tx, fee, label):
|
def sign_done(tx):
|
||||||
if tx.error:
|
if tx.error:
|
||||||
self.show_message(tx.error)
|
self.show_message(tx.error)
|
||||||
self.send_button.setDisabled(False)
|
self.send_button.setDisabled(False)
|
||||||
|
@ -1047,6 +1049,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
|
|
||||||
self.broadcast_transaction(tx)
|
self.broadcast_transaction(tx)
|
||||||
|
|
||||||
|
# keep a reference to WaitingDialog or the gui might crash
|
||||||
self.waiting_dialog = WaitingDialog(self, 'Signing..', sign_thread, sign_done)
|
self.waiting_dialog = WaitingDialog(self, 'Signing..', sign_thread, sign_done)
|
||||||
self.waiting_dialog.start()
|
self.waiting_dialog.start()
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,10 @@ class WaitingDialog(QThread):
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.on_complete:
|
if self.on_complete:
|
||||||
self.on_complete(*self.result)
|
if type(self.result) is tuple:
|
||||||
|
self.on_complete(*self.result)
|
||||||
|
else:
|
||||||
|
self.on_complete(self.result)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue