parent
9f7e256e39
commit
93619c8341
|
@ -2288,25 +2288,17 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
return self.tx_from_text(file_content)
|
||||
|
||||
def do_process_from_text(self):
|
||||
from electrum.transaction import SerializationError
|
||||
text = text_dialog(self, _('Input raw transaction'), _("Transaction:"), _("Load transaction"))
|
||||
if not text:
|
||||
return
|
||||
try:
|
||||
tx = self.tx_from_text(text)
|
||||
if tx:
|
||||
self.show_transaction(tx)
|
||||
except SerializationError as e:
|
||||
self.show_critical(_("Electrum was unable to deserialize the transaction:") + "\n" + str(e))
|
||||
tx = self.tx_from_text(text)
|
||||
if tx:
|
||||
self.show_transaction(tx)
|
||||
|
||||
def do_process_from_file(self):
|
||||
from electrum.transaction import SerializationError
|
||||
try:
|
||||
tx = self.read_tx_from_file()
|
||||
if tx:
|
||||
self.show_transaction(tx)
|
||||
except SerializationError as e:
|
||||
self.show_critical(_("Electrum was unable to deserialize the transaction:") + "\n" + str(e))
|
||||
tx = self.read_tx_from_file()
|
||||
if tx:
|
||||
self.show_transaction(tx)
|
||||
|
||||
def do_process_from_txid(self):
|
||||
from electrum import transaction
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
import copy
|
||||
import datetime
|
||||
import json
|
||||
import traceback
|
||||
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
|
@ -36,15 +37,23 @@ from electrum.plugins import run_hook
|
|||
|
||||
from electrum.util import bfh
|
||||
from electrum.wallet import AddTransactionException
|
||||
from electrum.transaction import SerializationError
|
||||
|
||||
from .util import *
|
||||
|
||||
dialogs = [] # Otherwise python randomly garbage collects the dialogs...
|
||||
|
||||
|
||||
def show_transaction(tx, parent, desc=None, prompt_if_unsaved=False):
|
||||
d = TxDialog(tx, parent, desc, prompt_if_unsaved)
|
||||
dialogs.append(d)
|
||||
d.show()
|
||||
try:
|
||||
d = TxDialog(tx, parent, desc, prompt_if_unsaved)
|
||||
except SerializationError as e:
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
parent.show_critical(_("Electrum was unable to deserialize the transaction:") + "\n" + str(e))
|
||||
else:
|
||||
dialogs.append(d)
|
||||
d.show()
|
||||
|
||||
|
||||
class TxDialog(QDialog, MessageBoxMixin):
|
||||
|
||||
|
@ -58,7 +67,10 @@ class TxDialog(QDialog, MessageBoxMixin):
|
|||
# e.g. the FX plugin. If this happens during or after a long
|
||||
# sign operation the signatures are lost.
|
||||
self.tx = copy.deepcopy(tx)
|
||||
self.tx.deserialize()
|
||||
try:
|
||||
self.tx.deserialize()
|
||||
except BaseException as e:
|
||||
raise SerializationError(e)
|
||||
self.main_window = parent
|
||||
self.wallet = parent.wallet
|
||||
self.prompt_if_unsaved = prompt_if_unsaved
|
||||
|
|
Loading…
Reference in New Issue