network: sanitize tx broadcast response
This commit is contained in:
@@ -6,6 +6,7 @@ from electrum import WalletStorage, Wallet
|
||||
from electrum.util import format_satoshis, set_verbosity
|
||||
from electrum.bitcoin import is_address, COIN, TYPE_ADDRESS
|
||||
from electrum.transaction import TxOutput
|
||||
from electrum.network import TxBroadcastError, BestEffortRequestFailed
|
||||
|
||||
_ = lambda x:x # i18n
|
||||
|
||||
@@ -205,10 +206,12 @@ class ElectrumGui:
|
||||
print(_("Please wait..."))
|
||||
try:
|
||||
self.network.run_from_another_thread(self.network.broadcast_transaction(tx))
|
||||
except Exception as e:
|
||||
display_msg = _('The server returned an error when broadcasting the transaction.')
|
||||
display_msg += '\n' + repr(e)
|
||||
print(display_msg)
|
||||
except TxBroadcastError as e:
|
||||
msg = e.get_message_for_gui()
|
||||
print(msg)
|
||||
except BestEffortRequestFailed as e:
|
||||
msg = repr(e)
|
||||
print(msg)
|
||||
else:
|
||||
print(_('Payment sent.'))
|
||||
#self.do_clear()
|
||||
|
||||
Reference in New Issue
Block a user