def tx_out_cacher(self):
     print("DEBUG: Started tx_out_cacher process.")
     database_connector = address_reuse.db.Database(TEMP_DB_FILENAME)
     local_block_reader = address_reuse.blockchain_reader.LocalBlockchainRPCReader(database_connector)
     block_processor = address_reuse.block_processor.BlockProcessor(local_block_reader, database_connector)
     for i in range(0, 171):
         print("DEBUG: tx_out_cacher @ height %d" % i)
         block_processor.cache_tx_output_addresses_for_block_only(i)
 def tx_out_cacher(self):
     print("DEBUG: Started tx_out_cacher process.")
     database_connector = address_reuse.db.Database(TEMP_DB_FILENAME)
     local_block_reader = address_reuse.blockchain_reader.LocalBlockchainRPCReader(
         database_connector)
     block_processor = address_reuse.block_processor.BlockProcessor(
         local_block_reader, database_connector)
     for i in range(0, 171):
         print("DEBUG: tx_out_cacher @ height %d" % i)
         block_processor.cache_tx_output_addresses_for_block_only(i)
benchmarker = address_reuse.benchmark.block_reader_benchmark.Benchmark()

last_block_height_processed = None
num_blocks_processed = 0
try:
    while current_height_iterated < current_blockchain_height:
        print(
            (
                "DEBUG: update_txout_cache.py: current block height of "
                "blockchain is %d, last block processed in db is %d, %d "
                "remaining blocks to process in this run."
            )
            % (current_blockchain_height, current_height_iterated, num_blocks_remaining_to_process)
        )

        block_processor.cache_tx_output_addresses_for_block_only(current_height_iterated, benchmarker)

        print("Completed processing of block at height %d." % current_height_iterated)
        last_block_height_processed = current_height_iterated
        current_height_iterated = current_height_iterated + 1

        num_blocks_remaining_to_process = num_blocks_remaining_to_process - 1
        num_blocks_processed = num_blocks_processed + 1

        # Log successful processing of this block
        address_reuse.logger.log_status("Cached all tx output addreses for block %d." % last_block_height_processed)

except KeyboardInterrupt:
    pass  # Nothing to do here, already commits to db once per block
except Exception as e:
    traceback.print_exc()
示例#4
0
block_processor = address_reuse.block_processor.BlockProcessor(
    local_block_reader, db)

benchmarker = address_reuse.benchmark.block_reader_benchmark.Benchmark()

last_block_height_processed = None
num_blocks_processed = 0
try:
    while (current_height_iterated < current_blockchain_height):
        print(("DEBUG: update_txout_cache.py: current block height of "
               "blockchain is %d, last block processed in db is %d, %d "
               "remaining blocks to process in this run.") %
              (current_blockchain_height, current_height_iterated,
               num_blocks_remaining_to_process))

        block_processor.cache_tx_output_addresses_for_block_only(
            current_height_iterated, benchmarker)

        print("Completed processing of block at height %d." %
              current_height_iterated)
        last_block_height_processed = current_height_iterated
        current_height_iterated = current_height_iterated + 1

        num_blocks_remaining_to_process = num_blocks_remaining_to_process - 1
        num_blocks_processed = num_blocks_processed + 1

        #Log successful processing of this block
        address_reuse.logger.log_status(
            'Cached all tx output addreses for block %d.' %
            last_block_height_processed)

except KeyboardInterrupt: