cli: config changes

This commit is contained in:
nym21
2025-07-26 00:46:35 +02:00
parent ed70ad7378
commit 241b9312b7
2 changed files with 6 additions and 5 deletions

View File

@@ -18,7 +18,7 @@ pub fn run() -> color_eyre::Result<()> {
let format = config.format(); 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 wait_for_synced_node = |rpc_client: &bitcoincore_rpc::Client| -> color_eyre::Result<()> {
let is_synced = || -> color_eyre::Result<bool> { let is_synced = || -> color_eyre::Result<bool> {
@@ -37,7 +37,7 @@ pub fn run() -> color_eyre::Result<()> {
}; };
let mut computer = Computer::forced_import( let mut computer = Computer::forced_import(
&config.outputsdir(), &config.brkdir(),
&indexer, &indexer,
config.computation(), config.computation(),
config.fetcher(), config.fetcher(),

View File

@@ -7,6 +7,7 @@ use std::{
use brk_core::{Error, Result}; use brk_core::{Error, Result};
use libc::off_t; use libc::off_t;
use log::info;
use memmap2::{MmapMut, MmapOptions}; use memmap2::{MmapMut, MmapOptions};
use parking_lot::{RwLock, RwLockReadGuard}; use parking_lot::{RwLock, RwLockReadGuard};
@@ -461,10 +462,10 @@ impl File {
.try_for_each(|(&start, &hole)| -> Result<()> { .try_for_each(|(&start, &hole)| -> Result<()> {
assert!(start % PAGE_SIZE == 0); assert!(start % PAGE_SIZE == 0);
assert!(hole % PAGE_SIZE == 0); assert!(hole % PAGE_SIZE == 0);
let has_old_data = (((start / PAGE_SIZE) as usize) let has_old_data =
..((start + hole) / PAGE_SIZE) as usize) mmap[start as usize] != 0 || mmap[(start + hole - PAGE_SIZE) as usize] != 0;
.any(|i| mmap[i * PAGE_SIZE as usize] != 0);
if has_old_data { if has_old_data {
info!("Punching a hole of {hole} bytes at {start}...");
Self::punch_hole_(file, start, hole) Self::punch_hole_(file, start, hole)
} else { } else {
Ok(()) Ok(())