Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 894068e

Browse files
authored
Merge pull request #1325 from carver/peer-header-catchup
Enable header peer catchup
2 parents 206f174 + 0c9b8c9 commit 894068e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

trinity/sync/common/chain.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,17 @@ async def _sync(self, peer: HeaderRequestingPeer) -> None:
188188
[header async for header in self._get_missing_tail(all_headers)]
189189
)
190190
if len(headers) == 0 and len(all_headers) > 0:
191-
self.logger.debug("All headers were redundant, requesting the next batch.")
191+
head = await self.wait(self.db.coro_get_canonical_head())
192+
start_at = max(
193+
all_headers[-1].block_number + 1,
194+
head.block_number - MAX_REORG_DEPTH
195+
)
196+
self.logger.debug(
197+
"All %d headers redundant, head at #%d, fetching from #%d",
198+
len(all_headers),
199+
head.block_number,
200+
start_at,
201+
)
192202
continue
193203
else:
194204
headers = all_headers

0 commit comments

Comments
 (0)