mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 09:21:39 +00:00
gui: prepend broadcast_transaction errors with explanatory message
This commit is contained in:
parent
b491a30dd9
commit
5248613e9d
5 changed files with 17 additions and 6 deletions
|
@ -937,8 +937,11 @@ class ElectrumWindow(App):
|
|||
self.wallet.invoices.save()
|
||||
self.update_tab('invoices')
|
||||
else:
|
||||
msg = msg[:500] if msg else _('There was an error broadcasting the transaction.')
|
||||
self.show_error(msg)
|
||||
display_msg = _('The server returned an error when broadcasting the transaction.')
|
||||
if msg:
|
||||
display_msg += '\n' + msg
|
||||
display_msg = display_msg[:500]
|
||||
self.show_error(display_msg)
|
||||
|
||||
if self.network and self.network.is_connected():
|
||||
self.show_info(_('Sending'))
|
||||
|
|
|
@ -1690,7 +1690,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
self.invoice_list.update()
|
||||
self.do_clear()
|
||||
else:
|
||||
parent.show_error(msg)
|
||||
display_msg = _('The server returned an error when broadcasting the transaction.')
|
||||
if msg:
|
||||
display_msg += '\n' + msg
|
||||
parent.show_error(display_msg)
|
||||
|
||||
WaitingDialog(self, _('Broadcasting transaction...'),
|
||||
broadcast_thread, broadcast_done, self.on_error)
|
||||
|
|
|
@ -206,7 +206,9 @@ class ElectrumGui:
|
|||
try:
|
||||
self.network.run_from_another_thread(self.network.broadcast_transaction(tx))
|
||||
except Exception as e:
|
||||
print(repr(e))
|
||||
display_msg = _('The server returned an error when broadcasting the transaction.')
|
||||
display_msg += '\n' + repr(e)
|
||||
print(display_msg)
|
||||
else:
|
||||
print(_('Payment sent.'))
|
||||
#self.do_clear()
|
||||
|
|
|
@ -15,7 +15,7 @@ from electrum.storage import WalletStorage
|
|||
from electrum.network import NetworkParameters
|
||||
from electrum.interface import deserialize_server
|
||||
|
||||
_ = lambda x:x
|
||||
_ = lambda x:x # i18n
|
||||
|
||||
|
||||
class ElectrumGui:
|
||||
|
@ -370,7 +370,9 @@ class ElectrumGui:
|
|||
try:
|
||||
self.network.run_from_another_thread(self.network.broadcast_transaction(tx))
|
||||
except Exception as e:
|
||||
self.show_message(repr(e))
|
||||
display_msg = _('The server returned an error when broadcasting the transaction.')
|
||||
display_msg += '\n' + repr(e)
|
||||
self.show_message(display_msg)
|
||||
else:
|
||||
self.show_message(_('Payment sent.'))
|
||||
self.do_clear()
|
||||
|
|
|
@ -737,6 +737,7 @@ class Network(PrintError):
|
|||
timeout = self.get_network_timeout_seconds(NetworkTimeout.Urgent)
|
||||
out = await self.interface.session.send_request('blockchain.transaction.broadcast', [str(tx)], timeout=timeout)
|
||||
if out != tx.txid():
|
||||
# note: this is untrusted input from the server
|
||||
raise Exception(out)
|
||||
return out # txid
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue