commit 5c2235e54bff91680c2d08b7722707688b0c426d
parent c224a9ad9d63b3f20f7e0c796352ba2b0f518a4c
Author: ThomasV <thomasv@gitorious>
Date: Sat, 4 Jul 2015 17:33:18 +0200
make tx.deserialize preserve existing inputs
Diffstat:
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/gui/qt/transaction_dialog.py b/gui/qt/transaction_dialog.py
@@ -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
@@ -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
diff --git a/lib/transaction.py b/lib/transaction.py
@@ -482,6 +482,7 @@ class Transaction:
def __init__(self, raw):
self.raw = raw
+ self.inputs = None
def update(self, raw):
self.raw = raw
@@ -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']]