received coins need to be known before
authorthomasv <thomasv@gitorious>
Thu, 22 Nov 2012 12:24:44 +0000 (13:24 +0100)
committerthomasv <thomasv@gitorious>
Thu, 22 Nov 2012 12:24:44 +0000 (13:24 +0100)
lib/wallet.py

index 756bd4b..d24ffde 100644 (file)
@@ -487,6 +487,14 @@ class Wallet:
         for tx_hash, tx_height in h:
             d = self.transactions.get(tx_hash)
             if not d: continue
+            for item in d.get('outputs'):
+                addr = item.get('address')
+                key = tx_hash + ':%d'%item['index']
+                received_coins.append(key)
+
+        for tx_hash, tx_height in h:
+            d = self.transactions.get(tx_hash)
+            if not d: continue
             v = 0
 
             for item in d.get('inputs'):
@@ -502,7 +510,6 @@ class Wallet:
                 key = tx_hash + ':%d'%item['index']
                 if addr == address:
                     v += item.get('value')
-                received_coins.append(key)
 
             if tx_height:
                 c += v