diff --git a/crates/brk_cli/src/run.rs b/crates/brk_cli/src/run.rs index c41e72404..41328e299 100644 --- a/crates/brk_cli/src/run.rs +++ b/crates/brk_cli/src/run.rs @@ -18,7 +18,7 @@ pub fn run() -> color_eyre::Result<()> { let format = config.format(); - let mut indexer = Indexer::forced_import(&config.outputsdir())?; + let mut indexer = Indexer::forced_import(&config.brkdir())?; let wait_for_synced_node = |rpc_client: &bitcoincore_rpc::Client| -> color_eyre::Result<()> { let is_synced = || -> color_eyre::Result { @@ -37,7 +37,7 @@ pub fn run() -> color_eyre::Result<()> { }; let mut computer = Computer::forced_import( - &config.outputsdir(), + &config.brkdir(), &indexer, config.computation(), config.fetcher(), diff --git a/crates/brk_vecs/src/file/mod.rs b/crates/brk_vecs/src/file/mod.rs index ba250e857..d43eb9785 100644 --- a/crates/brk_vecs/src/file/mod.rs +++ b/crates/brk_vecs/src/file/mod.rs @@ -7,6 +7,7 @@ use std::{ use brk_core::{Error, Result}; use libc::off_t; +use log::info; use memmap2::{MmapMut, MmapOptions}; use parking_lot::{RwLock, RwLockReadGuard}; @@ -461,10 +462,10 @@ impl File { .try_for_each(|(&start, &hole)| -> Result<()> { assert!(start % PAGE_SIZE == 0); assert!(hole % PAGE_SIZE == 0); - let has_old_data = (((start / PAGE_SIZE) as usize) - ..((start + hole) / PAGE_SIZE) as usize) - .any(|i| mmap[i * PAGE_SIZE as usize] != 0); + let has_old_data = + mmap[start as usize] != 0 || mmap[(start + hole - PAGE_SIZE) as usize] != 0; if has_old_data { + info!("Punching a hole of {hole} bytes at {start}..."); Self::punch_hole_(file, start, hole) } else { Ok(())