Skip to content

Commit 6b88ae3

Browse files
authored
More significant digits in block_rate (#19608)
1 parent f3d5dae commit 6b88ae3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

chia/full_node/full_node.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ async def ingest_blocks(
13461346
],
13471347
) -> None:
13481348
nonlocal fork_info
1349-
block_rate = 0
1349+
block_rate = 0.0
13501350
block_rate_time = time.monotonic()
13511351
block_rate_height = -1
13521352
while True:
@@ -1377,12 +1377,13 @@ async def ingest_blocks(
13771377
raise ValueError(f"Failed to validate block batch {start_height} to {end_height}: {err}")
13781378
if end_height - block_rate_height > 100:
13791379
now = time.monotonic()
1380-
block_rate = int((end_height - block_rate_height) // (now - block_rate_time))
1380+
block_rate = (end_height - block_rate_height) / (now - block_rate_time)
13811381
block_rate_time = now
13821382
block_rate_height = end_height
13831383

13841384
self.log.info(
1385-
f"Added blocks {start_height} to {end_height} ({block_rate} blocks/s) (from: {peer.peer_info.ip})"
1385+
"Added blocks {start_height} to {end_height} "
1386+
f"({block_rate:.3g} blocks/s) (from: {peer.peer_info.ip})"
13861387
)
13871388
peak: Optional[BlockRecord] = self.blockchain.get_peak()
13881389
if state_change_summary is not None:

0 commit comments

Comments
 (0)