fix createrawtransaction (issue #574)
authorThomasV <thomasv@gitorious>
Sun, 2 Mar 2014 18:24:44 +0000 (19:24 +0100)
committerThomasV <thomasv@gitorious>
Sun, 2 Mar 2014 18:24:44 +0000 (19:24 +0100)
lib/commands.py
lib/transaction.py

index c83f5d9..7ce7588 100644 (file)
@@ -160,14 +160,12 @@ class Commands:
 
 
     def createrawtransaction(self, inputs, outputs):
-        # convert to own format
-        for i in inputs:
-            i['tx_hash'] = i['txid']
-            i['index'] = i['vout']
+        inputs = map(lambda i: {'prevout_hash': i['txid'], 'prevout_n':i['vout']}, inputs )
         outputs = map(lambda x: (x[0],int(1e8*x[1])), outputs.items())
         tx = Transaction.from_io(inputs, outputs)
         return tx
 
+
     def signrawtransaction(self, raw_tx, input_info, private_keys):
         tx = Transaction(raw_tx)
         self.wallet.signrawtransaction(tx, input_info, private_keys, self.password)
index 0207890..136303b 100644 (file)
@@ -671,7 +671,7 @@ class Transaction:
             item = { 
                 'prevout_hash':i['prevout_hash'], 
                 'prevout_n':i['prevout_n'],
-                'address':i['address'],
+                'address':i.get('address'),
                 'KeyID':i.get('KeyID'),
                 'scriptPubKey':i.get('scriptPubKey'),
                 'redeemScript':i.get('redeemScript'),