Merge pull request #28 from jkozera/patch-3
authorThomasV <thomasv1@gmx.de>
Mon, 15 Apr 2013 13:39:26 +0000 (06:39 -0700)
committerThomasV <thomasv1@gmx.de>
Mon, 15 Apr 2013 13:39:26 +0000 (06:39 -0700)
Get address from mempool for prevout not in db

1  2 
backends/bitcoind/blockchain_processor.py

@@@ -340,7 -340,7 +340,7 @@@ class BlockchainProcessor(Processor)
          for i in range(l-1, -1, -1):
              item = serialized_hist[80*i:80*(i+1)]
              item_height = int(rev_hex(item[36:39].encode('hex')), 16)
 -            if item_height < tx_height:
 +            if item_height <= tx_height:
                  serialized_hist = serialized_hist[0:80*(i+1)] + s + serialized_hist[80*(i+1):]
                  break
          else:
                  try:
                      addr = self.db.Get(txi)
                  except:
-                     continue
+                     tx_prev = self.get_mempool_transaction(x.get('prevout_hash'))
+                     try:
+                         addr = tx_prev['outputs'][x.get('prevout_n')]['address']
+                         if not addr: continue
+                     except:
+                         continue
                  l = self.mempool_addresses.get(tx_hash, [])
                  if addr not in l:
                      l.append(addr)