Skip to content

Commit aabbe9d

Browse files
committed
Log when fast-sync has finished
1 parent ed1514a commit aabbe9d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

trinity/sync/full/service.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,30 @@ async def _run(self) -> None:
4242
# See https://github.com/ethereum/py-evm/issues/654 for more details
4343
if head.timestamp < time.time() - FAST_SYNC_CUTOFF:
4444
# Fast-sync chain data.
45-
self.logger.info("Starting fast-sync; current head: #%d", head.block_number)
45+
self.logger.info("Starting fast-sync; current head: %s", head)
4646
fast_syncer = FastChainSyncer(
4747
self.chain,
4848
self.chaindb,
4949
self.peer_pool,
5050
self.cancel_token,
5151
)
5252
await fast_syncer.run()
53+
54+
previous_head = head
55+
head = await self.wait(self.chaindb.coro_get_canonical_head())
56+
self.logger.info(
57+
"Finished fast fast-sync; previous head: %s, current head: %s", previous_head, head
58+
)
5359
# remove the reference so the memory can be reclaimed
5460
del fast_syncer
5561

5662
if self.cancel_token.triggered:
5763
return
5864

5965
# Ensure we have the state for our current head.
60-
head = await self.wait(self.chaindb.coro_get_canonical_head())
6166
if head.state_root != BLANK_ROOT_HASH and head.state_root not in self.base_db:
6267
self.logger.info(
63-
"Missing state for current head (#%d), downloading it", head.block_number)
68+
"Missing state for current head %s, downloading it", head)
6469
downloader = StateDownloader(
6570
self.chaindb, self.base_db, head.state_root, self.peer_pool, self.cancel_token)
6671
await downloader.run()
@@ -71,7 +76,7 @@ async def _run(self) -> None:
7176
return
7277

7378
# Now, loop forever, fetching missing blocks and applying them.
74-
self.logger.info("Starting regular sync; current head: #%d", head.block_number)
79+
self.logger.info("Starting regular sync; current head: %s", head)
7580
regular_syncer = RegularChainSyncer(
7681
self.chain, self.chaindb, self.peer_pool, self.cancel_token)
7782
await regular_syncer.run()

0 commit comments

Comments
 (0)