Compare commits

..

No commits in common. "212b06ea5cadc8e6ed9472c5c20b379da530ed4d" and "master" have entirely different histories.

3 changed files with 12 additions and 29 deletions

View File

@ -7,22 +7,15 @@ import argparse
# external imports # external imports
import confini import confini
from chainsyncer.backend.memory import MemBackend from chainsyncer.backend.memory import MemBackend
from chainsyncer.driver.head import HeadSyncer from chainsyncer.driver import (
from chainsyncer.driver.history import HistorySyncer HeadSyncer,
HistorySyncer,
)
from chainsyncer.filter import SyncFilter from chainsyncer.filter import SyncFilter
from chainsyncer.error import NoBlockForYou from chainsyncer.error import NoBlockForYou
from chainlib.chain import ChainSpec from chainlib.chain import ChainSpec
from chainlib.eth.connection import EthHTTPConnection from chainlib.eth.connection import EthHTTPConnection
from chainlib.interface import ChainInterface from chainlib.eth.block import block_latest
from chainlib.eth.block import (
block_by_number,
Block,
block_latest,
)
from chainlib.eth.tx import (
receipt,
Tx,
)
# local imports # local imports
from eth_stat_syncer.store import ( from eth_stat_syncer.store import (
@ -77,15 +70,6 @@ class GasPriceFilter(SyncFilter):
self.gas_aggregator.put(tx.gas_price) self.gas_aggregator.put(tx.gas_price)
class EthChainInterface(ChainInterface):
def __init__(self):
self._block_by_number = block_by_number
self._block_from_src = Block.from_src
self._tx_receipt = receipt
self._src_normalize = Tx.src_normalize
def main(): def main():
gas_store = RunStore(basedir=config.get('STORE_BASE_DIR')) gas_store = RunStore(basedir=config.get('STORE_BASE_DIR'))
gas_aggregator = GasAggregator(gas_store, 360) gas_aggregator = GasAggregator(gas_store, 360)
@ -97,12 +81,11 @@ def main():
start_block = n start_block = n
logg.info('block height at start {}'.format(start_block)) logg.info('block height at start {}'.format(start_block))
chain_interface = EthChainInterface()
if config.get('_START') != None: if config.get('_START') != None:
offset = start_block - config.get('_START') offset = start_block - config.get('_START')
syncer_backend = MemBackend.custom(chain_spec, start_block) syncer_backend = MemBackend(chain_spec, None, target_block=start_block)
syncer_backend.set(offset, 0) syncer_backend.set(offset, 0)
syncer = HistorySyncer(syncer_backend, chain_interface, block_callback=gas_aggregator.block_callback) syncer = HistorySyncer(syncer_backend, block_callback=gas_aggregator.block_callback)
syncer.add_filter(gas_filter) syncer.add_filter(gas_filter)
try: try:
syncer.loop(0.0, conn) syncer.loop(0.0, conn)
@ -111,7 +94,7 @@ def main():
syncer_backend = MemBackend(chain_spec, None) syncer_backend = MemBackend(chain_spec, None)
syncer_backend.set(start_block + 1, 0) syncer_backend.set(start_block + 1, 0)
syncer = HeadSyncer(syncer_backend, chain_interface, block_callback=gas_aggregator.block_callback) syncer = HeadSyncer(syncer_backend, block_callback=gas_aggregator.block_callback)
syncer.add_filter(gas_filter) syncer.add_filter(gas_filter)
syncer.loop(1.0, conn) syncer.loop(1.0, conn)

View File

@ -1,3 +1,3 @@
chainsyncer~=0.2.0 chainsyncer~=0.0.2a3
chainlib-eth>=0.1.0b1,<=0.1.0 chainlib~=0.0.3a1
jsonrpc_std~=0.1.0 jsonrpc_std~=0.0.1a2

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = eth-stat-syncer name = eth-stat-syncer
version = 0.1.0 version = 0.0.1a3
description = Cache live EVM blockchain stats description = Cache live EVM blockchain stats
author = Louis Holbrook author = Louis Holbrook
author_email = dev@holbrook.no author_email = dev@holbrook.no