Skip to content

Commit a4b947f

Browse files
authored
Merge pull request #56 from rustaceanrob/12-8-lgos
node: Make logging more descriptive
2 parents 1bdb86f + e5dd8ca commit a4b947f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

node/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ pub fn get_blocks_for_range(
184184
) {
185185
let mut batch = Vec::new();
186186
let mut rng = thread_rng();
187+
let stop_height = { hints.lock().unwrap().stop_height() };
187188
loop {
188189
let peer = {
189190
let lock_opt = peers.lock().ok();
@@ -296,9 +297,14 @@ pub fn get_blocks_for_range(
296297
"[thread {task_id:2}]: requesting next batch. blocks downloaded: {}",
297298
CHUNK_SIZE * completed_batches
298299
);
300+
let percent = (1.
301+
- ((CHUNK_SIZE * jobs_lock.len()) as f32 / stop_height as f32))
302+
* 100.0;
299303
tracing::info!(
300-
"[thread m]: blocks remaining {}",
301-
CHUNK_SIZE * jobs_lock.len()
304+
"[thread m]: {:.6}/{}; progress: {:.6}%",
305+
CHUNK_SIZE * jobs_lock.len(),
306+
stop_height,
307+
percent,
302308
);
303309
let payload = InventoryPayload(
304310
batch.iter().map(|hash| Inventory::Block(*hash)).collect(),

0 commit comments

Comments
 (0)