Skip to content

Commit f46c223

Browse files
committed
use enumerate when iterating to track index and item
1 parent d1da1b2 commit f46c223

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/new_index/fetch.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ fn bitcoind_fetcher(
8787
let mut fetcher_count = 0;
8888
let mut blocks_fetched = 0;
8989
let total_blocks_fetched = new_headers.len();
90-
for entries in new_headers.chunks(100) {
90+
for entries in new_headers.chunks(100)
91+
{
9192
if fetcher_count % 50 == 0 && total_blocks_fetched >= 50 {
9293
info!("fetching blocks {}/{} ({:.1}%)",
9394
blocks_fetched,
@@ -186,10 +187,8 @@ fn blkfiles_reader(blk_files: Vec<PathBuf>, xor_key: Option<[u8; 8]>) -> Fetcher
186187
Fetcher::from(
187188
chan.into_receiver(),
188189
spawn_thread("blkfiles_reader", move || {
189-
let mut count = 0;
190190
let blk_files_len = blk_files.len();
191-
for path in blk_files {
192-
count += 1;
191+
for (count, path) in blk_files.iter().enumerate() {
193192
info!("block file reading {:}/{:} {:.2}%",
194193
count,
195194
blk_files_len,

0 commit comments

Comments
 (0)