From 29c4902234d46b8f6e12880bcab28e11e80310c9 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 29 Mar 2024 16:47:48 -0400 Subject: [PATCH] runner/walker backfill off-by-one bugfix --- src/dexorder/runner.py | 2 +- src/dexorder/walker.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dexorder/runner.py b/src/dexorder/runner.py index 3d9ca3c..2a48a8a 100644 --- a/src/dexorder/runner.py +++ b/src/dexorder/runner.py @@ -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) diff --git a/src/dexorder/walker.py b/src/dexorder/walker.py index cfacd21..07078f2 100644 --- a/src/dexorder/walker.py +++ b/src/dexorder/walker.py @@ -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():