Handle open end
This commit is contained in:
parent
7b94b17fd3
commit
de201bc199
@ -30,7 +30,7 @@ logg = logging.getLogger()
|
|||||||
arg_flags = chainlib.eth.cli.argflag_std_read
|
arg_flags = chainlib.eth.cli.argflag_std_read
|
||||||
argparser = chainlib.eth.cli.ArgumentParser(arg_flags)
|
argparser = chainlib.eth.cli.ArgumentParser(arg_flags)
|
||||||
argparser.add_argument('--start', type=int, help='start at block')
|
argparser.add_argument('--start', type=int, help='start at block')
|
||||||
argparser.add_argument('--end', type=int, default=0, help='end block (not inclusive)')
|
argparser.add_argument('--end', type=int, help='end block (not inclusive)')
|
||||||
argparser.add_argument('--interval', type=int, default=5, help='syncer poll interval for new blocks')
|
argparser.add_argument('--interval', type=int, default=5, help='syncer poll interval for new blocks')
|
||||||
argparser.add_argument('-d', type=str, required=True, help='output directory')
|
argparser.add_argument('-d', type=str, required=True, help='output directory')
|
||||||
argparser.add_positional('address', type=str, append=True, help='address sender to monitor')
|
argparser.add_positional('address', type=str, append=True, help='address sender to monitor')
|
||||||
@ -80,7 +80,7 @@ class GasAddFilter:
|
|||||||
if sender in self.addresses:
|
if sender in self.addresses:
|
||||||
self.gas_sum += tx.gas_used
|
self.gas_sum += tx.gas_used
|
||||||
self.tx_gas[tx.hash] = tx.gas_used
|
self.tx_gas[tx.hash] = tx.gas_used
|
||||||
logg.debug('sender {} tx {} gas {} new sum {}'.format(sender, tx.hash, tx.gas_used, self.gas_sum))
|
logg.info('sender {} tx {} gas {} new sum {}'.format(sender, tx.hash, tx.gas_used, self.gas_sum))
|
||||||
|
|
||||||
|
|
||||||
def sum(self):
|
def sum(self):
|
||||||
@ -103,11 +103,12 @@ def main():
|
|||||||
backend = FileBackend.initial(chain_spec, end, start_block_height=start, base_dir=config.get('_OUTPUT_DIR'))
|
backend = FileBackend.initial(chain_spec, end, start_block_height=start, base_dir=config.get('_OUTPUT_DIR'))
|
||||||
syncer = HistorySyncer(backend, chain_interface)
|
syncer = HistorySyncer(backend, chain_interface)
|
||||||
else:
|
else:
|
||||||
FileBackend.live(chain_spec, start, base_dir=config.get('_OUTPUT_DIR'))
|
backend = FileBackend.live(chain_spec, start, base_dir=config.get('_OUTPUT_DIR'))
|
||||||
syncer = HeadSyncer(backend, chain_interface)
|
syncer = HeadSyncer(backend, chain_interface)
|
||||||
|
|
||||||
gas_filter = GasAddFilter(chain_spec, config.get('_ADDRESS'))
|
gas_filter = GasAddFilter(chain_spec, config.get('_ADDRESS'))
|
||||||
syncer.add_filter(gas_filter)
|
syncer.add_filter(gas_filter)
|
||||||
|
|
||||||
r = syncer.loop(config.get('SYNCER_LOOP_INTERVAL'), conn)
|
r = syncer.loop(config.get('SYNCER_LOOP_INTERVAL'), conn)
|
||||||
for k in gas_filter.tx_gas.keys():
|
for k in gas_filter.tx_gas.keys():
|
||||||
print('tx {} gas {}'.format(k, gas_filter.tx_gas[k]))
|
print('tx {} gas {}'.format(k, gas_filter.tx_gas[k]))
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
chainsyncer==0.0.7a3
|
chainsyncer==0.0.7a3
|
||||||
chainlib-eth==0.0.10a15
|
chainlib-eth==0.0.10a16
|
||||||
|
Loading…
Reference in New Issue
Block a user