make sure the broadcast tx thread always times out
This commit is contained in:
@@ -698,7 +698,7 @@ class ElectrumWindow(App):
|
||||
Clock.schedule_once(lambda dt: on_success(tx))
|
||||
|
||||
def _broadcast_thread(self, tx, on_complete):
|
||||
ok, txid = self.wallet.sendtx(tx)
|
||||
ok, txid = self.network.broadcast(tx)
|
||||
Clock.schedule_once(lambda dt: on_complete(ok, txid))
|
||||
|
||||
def broadcast(self, tx, pr=None):
|
||||
|
||||
@@ -1321,21 +1321,18 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
def broadcast_thread():
|
||||
# non-GUI thread
|
||||
pr = self.payment_request
|
||||
if pr is None:
|
||||
return self.wallet.sendtx(tx)
|
||||
if pr.has_expired():
|
||||
if pr and pr.has_expired():
|
||||
self.payment_request = None
|
||||
return False, _("Payment request has expired")
|
||||
status, msg = self.wallet.sendtx(tx)
|
||||
if not status:
|
||||
return False, msg
|
||||
pr.set_paid(tx.hash())
|
||||
self.invoices.save()
|
||||
self.payment_request = None
|
||||
refund_address = self.wallet.addresses()[0]
|
||||
ack_status, ack_msg = pr.send_ack(str(tx), refund_address)
|
||||
if ack_status:
|
||||
msg = ack_msg
|
||||
status, msg = self.network.broadcast(tx)
|
||||
if pr and status is True:
|
||||
pr.set_paid(tx.hash())
|
||||
self.invoices.save()
|
||||
self.payment_request = None
|
||||
refund_address = self.wallet.addresses()[0]
|
||||
ack_status, ack_msg = pr.send_ack(str(tx), refund_address)
|
||||
if ack_status:
|
||||
msg = ack_msg
|
||||
return status, msg
|
||||
|
||||
# Capture current TL window; override might be removed on return
|
||||
|
||||
@@ -195,10 +195,8 @@ class ElectrumGui:
|
||||
if self.str_description:
|
||||
self.wallet.labels[tx.hash()] = self.str_description
|
||||
|
||||
h = self.wallet.send_tx(tx)
|
||||
print(_("Please wait..."))
|
||||
self.wallet.tx_event.wait()
|
||||
status, msg = self.wallet.receive_tx( h, tx )
|
||||
status, msg = self.network.broadcast(tx)
|
||||
|
||||
if status:
|
||||
print(_('Payment sent.'))
|
||||
|
||||
@@ -337,10 +337,8 @@ class ElectrumGui:
|
||||
if self.str_description:
|
||||
self.wallet.labels[tx.hash()] = self.str_description
|
||||
|
||||
h = self.wallet.send_tx(tx)
|
||||
self.show_message(_("Please wait..."), getchar=False)
|
||||
self.wallet.tx_event.wait()
|
||||
status, msg = self.wallet.receive_tx( h, tx )
|
||||
status, msg = self.network.broadcast(tx)
|
||||
|
||||
if status:
|
||||
self.show_message(_('Payment sent.'))
|
||||
|
||||
Reference in New Issue
Block a user