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