commit de201bc199b1efa4d38f3fae6b5d212d398aa05a
parent 7b94b17fd3835f5b516dfb46821f9050866fb8b0
Author: nolash <dev@holbrook.no>
Date: Tue, 26 Oct 2021 08:29:58 +0200
Handle open end
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/eth_gas_sum/runnable/sum.py b/eth_gas_sum/runnable/sum.py
@@ -30,7 +30,7 @@ logg = logging.getLogger()
arg_flags = chainlib.eth.cli.argflag_std_read
argparser = chainlib.eth.cli.ArgumentParser(arg_flags)
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('-d', type=str, required=True, help='output directory')
argparser.add_positional('address', type=str, append=True, help='address sender to monitor')
@@ -80,7 +80,7 @@ class GasAddFilter:
if sender in self.addresses:
self.gas_sum += 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):
@@ -103,11 +103,12 @@ def main():
backend = FileBackend.initial(chain_spec, end, start_block_height=start, base_dir=config.get('_OUTPUT_DIR'))
syncer = HistorySyncer(backend, chain_interface)
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)
gas_filter = GasAddFilter(chain_spec, config.get('_ADDRESS'))
syncer.add_filter(gas_filter)
+
r = syncer.loop(config.get('SYNCER_LOOP_INTERVAL'), conn)
for k in gas_filter.tx_gas.keys():
print('tx {} gas {}'.format(k, gas_filter.tx_gas[k]))
diff --git a/requirements.txt b/requirements.txt
@@ -1,2 +1,2 @@
chainsyncer==0.0.7a3
-chainlib-eth==0.0.10a15
+chainlib-eth==0.0.10a16