tmake tx.deserialize preserve existing inputs - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 5c2235e54bff91680c2d08b7722707688b0c426d DIR parent c224a9ad9d63b3f20f7e0c796352ba2b0f518a4c HTML Author: ThomasV <thomasv@gitorious> Date: Sat, 4 Jul 2015 17:33:18 +0200 make tx.deserialize preserve existing inputs Diffstat: M gui/qt/transaction_dialog.py | 4 ++-- M lib/transaction.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) --- DIR diff --git a/gui/qt/transaction_dialog.py b/gui/qt/transaction_dialog.py t@@ -45,7 +45,7 @@ class TxDialog(QWidget): Pass desc to give a description for txs not yet in the wallet. ''' self.tx = tx - tx_dict = tx.as_dict() + self.tx.deserialize() self.parent = parent self.wallet = parent.wallet self.prompt_if_unsaved = prompt_if_unsaved t@@ -157,7 +157,7 @@ class TxDialog(QWidget): fileName = self.parent.getSaveFileName(_("Select where to save your signed transaction"), name, "*.txn") if fileName: with open(fileName, "w+") as f: - f.write(json.dumps(self.tx.as_dict(),indent=4) + '\n') + f.write(json.dumps(self.tx.as_dict(), indent=4) + '\n') self.show_message(_("Transaction saved successfully")) self.saved = True DIR diff --git a/lib/transaction.py b/lib/transaction.py t@@ -482,6 +482,7 @@ class Transaction: def __init__(self, raw): self.raw = raw + self.inputs = None def update(self, raw): self.raw = raw t@@ -518,6 +519,8 @@ class Transaction: def deserialize(self): + if self.inputs is not None: + return d = deserialize(self.raw) self.inputs = d['inputs'] self.outputs = [(x['type'], x['address'], x['value']) for x in d['outputs']]