wallet.set_broadcasting: fix incorrect type-hint and rename arg
This commit is contained in:
@@ -542,23 +542,23 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
||||
assert tx.is_complete()
|
||||
|
||||
def broadcast_thread():
|
||||
self.wallet.set_broadcasting(tx, PR_BROADCASTING)
|
||||
self.wallet.set_broadcasting(tx, broadcasting_status=PR_BROADCASTING)
|
||||
try:
|
||||
self._logger.info('running broadcast in thread')
|
||||
self.wallet.network.run_from_another_thread(self.wallet.network.broadcast_transaction(tx))
|
||||
except TxBroadcastError as e:
|
||||
self._logger.error(repr(e))
|
||||
self.broadcastFailed.emit(tx.txid(), '', e.get_message_for_gui())
|
||||
self.wallet.set_broadcasting(tx, None)
|
||||
self.wallet.set_broadcasting(tx, broadcasting_status=None)
|
||||
except BestEffortRequestFailed as e:
|
||||
self._logger.error(repr(e))
|
||||
self.broadcastFailed.emit(tx.txid(), '', repr(e))
|
||||
self.wallet.set_broadcasting(tx, None)
|
||||
self.wallet.set_broadcasting(tx, broadcasting_status=None)
|
||||
else:
|
||||
self._logger.info('broadcast success')
|
||||
self.broadcastSucceeded.emit(tx.txid())
|
||||
self.historyModel.requestRefresh.emit() # via qt thread
|
||||
self.wallet.set_broadcasting(tx, PR_BROADCAST)
|
||||
self.historyModel.requestRefresh.emit() # via qt thread
|
||||
self.wallet.set_broadcasting(tx, broadcasting_status=PR_BROADCAST)
|
||||
|
||||
threading.Thread(target=broadcast_thread, daemon=True).start()
|
||||
|
||||
|
||||
@@ -760,7 +760,7 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
|
||||
# Capture current TL window; override might be removed on return
|
||||
parent = self.window.top_level_window(lambda win: isinstance(win, MessageBoxMixin))
|
||||
|
||||
self.wallet.set_broadcasting(tx, PR_BROADCASTING)
|
||||
self.wallet.set_broadcasting(tx, broadcasting_status=PR_BROADCASTING)
|
||||
|
||||
def broadcast_done(result):
|
||||
# GUI thread
|
||||
@@ -769,11 +769,11 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
|
||||
if success:
|
||||
parent.show_message(_('Payment sent.') + '\n' + msg)
|
||||
self.invoice_list.update()
|
||||
self.wallet.set_broadcasting(tx, PR_BROADCAST)
|
||||
self.wallet.set_broadcasting(tx, broadcasting_status=PR_BROADCAST)
|
||||
else:
|
||||
msg = msg or ''
|
||||
parent.show_error(msg)
|
||||
self.wallet.set_broadcasting(tx, None)
|
||||
self.wallet.set_broadcasting(tx, broadcasting_status=None)
|
||||
|
||||
WaitingDialog(self, _('Broadcasting transaction...'),
|
||||
broadcast_thread, broadcast_done, self.window.on_error)
|
||||
|
||||
@@ -2549,13 +2549,13 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
||||
util.trigger_callback('request_status', self, request.get_id(), status)
|
||||
self._update_onchain_invoice_paid_detection(invoice_keys)
|
||||
|
||||
def set_broadcasting(self, tx: Transaction, b: bool):
|
||||
def set_broadcasting(self, tx: Transaction, *, broadcasting_status: Optional[int]):
|
||||
request_keys, invoice_keys = self.get_invoices_and_requests_touched_by_tx(tx)
|
||||
for key in invoice_keys:
|
||||
invoice = self._invoices.get(key)
|
||||
if not invoice:
|
||||
continue
|
||||
invoice._broadcasting_status = b
|
||||
invoice._broadcasting_status = broadcasting_status
|
||||
status = self.get_invoice_status(invoice)
|
||||
util.trigger_callback('invoice_status', self, key, status)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user