taint

Crypto forensics for private use
git clone git://git.defalsify.org/taint.git
Info | Log | Files | Refs | LICENSE

eth.py (1029B)


      1 # standard imports
      2 import uuid
      3 import logging
      4 
      5 # external imports
      6 from chainsyncer.driver import HistorySyncer
      7 from chainlib.eth.tx import (
      8         transaction,
      9         receipt,
     10         Tx,
     11         )
     12 
     13 logg = logging.getLogger(__name__)
     14 
     15 
     16 class EthCacheSyncer(HistorySyncer):
     17 
     18     def process(self, conn, block):
     19         (pair, fltr) = self.backend.get()
     20         try:
     21             tx = block.tx(pair[1])
     22         except AttributeError:
     23             o = transaction(block.txs[pair[1]])
     24             r = conn.do(o)
     25             tx = Tx(Tx.src_normalize(r), block=block)
     26         except IndexError as e:
     27             logg.debug('index error syncer rcpt get {}'.format(e))
     28             self.backend.set(block.number + 1, 0)
     29             return
     30 
     31         # TODO: Move specifics to eth subpackage, receipts are not a global concept
     32         rcpt = conn.do(receipt(tx.hash))
     33         if rcpt != None:
     34             tx.apply_receipt(Tx.src_normalize(rcpt))
     35 
     36         self.process_single(conn, block, tx)
     37 
     38         self.backend.set(pair[0], pair[1] + 1)