runner/walker backfill off-by-one bugfix

This commit is contained in:
Tim
2024-03-29 16:47:48 -04:00
parent f57c91a83a
commit 29c4902234
2 changed files with 2 additions and 2 deletions

View File

@@ -275,7 +275,7 @@ class BlockStateRunner(BlockProgressor):
log.debug(f'discarded late-arriving head {block}')
else:
batches: list
from_height = self.state.by_hash[fork.parent].height if fork.parent is not None else fork.height
from_height = self.state.by_hash[fork.parent].height + 1 if fork.parent is not None else fork.height
to_height = fork.height
if fork.disjoint:
batches = await self.get_backfill_batches(from_height, to_height, w3)

View File

@@ -82,7 +82,7 @@ class BlockWalker (BlockProgressor):
block = Block.from_data(chain_id, block_data)
assert block.height == cur_height
current_block.set(block)
await self.handle(processed_height, cur_height, chain=chain, w3=w3)
await self.handle(processed_height+1, cur_height, chain=chain, w3=w3)
if self.flush_delay is None or \
self.flush_type=='blocks' and last_flush + self.flush_delay <= processed_height or \
self.flush_type=='time' and last_flush + self.flush_delay <= now():