1
0

fix transaction parsing from command line

This commit is contained in:
ThomasV
2016-03-16 10:31:33 +01:00
parent 9608d9aa86
commit 9659e8542d
3 changed files with 27 additions and 22 deletions

View File

@@ -2244,21 +2244,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
def tx_from_text(self, txt):
"json or raw hexadecimal"
txt = txt.strip()
from electrum.transaction import tx_from_str
try:
txt.decode('hex')
is_hex = True
except:
is_hex = False
try:
if is_hex:
return Transaction(txt)
tx_dict = json.loads(str(txt))
assert "hex" in tx_dict.keys()
tx = Transaction(tx_dict["hex"])
return tx
return tx_from_str(txt)
except:
traceback.print_exc(file=sys.stdout)
self.show_critical(_("Electrum was unable to parse your transaction"))