Relax chainlib dep, bump version
This commit is contained in:
parent
cf1d4e4785
commit
1ea196d04b
@ -6,8 +6,8 @@ import time
|
|||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
def noop_progress(s):
|
def noop_progress(s, block_number, tx_index):
|
||||||
logg.debug(s)
|
logg.debug('({},{}) {}'.format(block_number, tx_index, s))
|
||||||
|
|
||||||
|
|
||||||
class Syncer:
|
class Syncer:
|
||||||
@ -44,11 +44,16 @@ class MinedSyncer(Syncer):
|
|||||||
|
|
||||||
def loop(self, interval, getter):
|
def loop(self, interval, getter):
|
||||||
while self.running and Syncer.running_global:
|
while self.running and Syncer.running_global:
|
||||||
|
g = self.backend.get()
|
||||||
|
start_tx = g[1]
|
||||||
|
self.progress_callback('loop awakened', g[0], start_tx)
|
||||||
while True:
|
while True:
|
||||||
block_hash = self.get(getter)
|
block = self.get(getter)
|
||||||
if block_hash == None:
|
if block == None:
|
||||||
break
|
break
|
||||||
self.process(getter, block_hash)
|
self.process(getter, block)
|
||||||
|
self.progress_callback('process block {}'.format(self.backend.get()), block.number, start_tx)
|
||||||
|
start_tx = 0
|
||||||
time.sleep(self.yield_delay)
|
time.sleep(self.yield_delay)
|
||||||
time.sleep(interval)
|
time.sleep(interval)
|
||||||
|
|
||||||
@ -60,18 +65,18 @@ class HeadSyncer(MinedSyncer):
|
|||||||
|
|
||||||
|
|
||||||
def process(self, getter, block):
|
def process(self, getter, block):
|
||||||
logg.debug('process {}'.format(block))
|
logg.debug('process block {}'.format(block))
|
||||||
i = 0
|
i = 0
|
||||||
tx = None
|
tx = None
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
#self.filter[0].handle(getter, block, None)
|
#self.filter[0].handle(getter, block, None)
|
||||||
tx = block.tx(i)
|
tx = block.tx(i)
|
||||||
self.progress_callback('processing {}'.format(tx))
|
self.progress_callback('processing {}'.format(repr(tx)), block.number, i)
|
||||||
self.backend.set(block.number, i)
|
self.backend.set(block.number, i)
|
||||||
for f in self.filter:
|
for f in self.filter:
|
||||||
f.handle(getter, block, tx)
|
f.handle(getter, block, tx)
|
||||||
self.progress_callback('applied filter {} on {}'.format(f.name(), tx))
|
self.progress_callback('applied filter {} on {}'.format(f.name(), repr(tx)), block.number, i)
|
||||||
except IndexError as e:
|
except IndexError as e:
|
||||||
self.backend.set(block.number + 1, 0)
|
self.backend.set(block.number + 1, 0)
|
||||||
break
|
break
|
||||||
|
@ -5,4 +5,4 @@ eth-tester==0.5.0b3
|
|||||||
confini==0.3.6b2
|
confini==0.3.6b2
|
||||||
semver==2.13.0
|
semver==2.13.0
|
||||||
hexathon==0.0.1a2
|
hexathon==0.0.1a2
|
||||||
chainlib==0.0.1a5
|
chainlib~=0.0.1a6
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = chainsyncer
|
name = chainsyncer
|
||||||
version = 0.0.1a3
|
version = 0.0.1a4
|
||||||
description = Generic blockchain syncer driver
|
description = Generic blockchain syncer driver
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
Loading…
Reference in New Issue
Block a user