global: fixes

This commit is contained in:
nym21
2026-04-27 12:52:02 +02:00
parent b24bfdc15c
commit 76869ed2b6
114 changed files with 6623 additions and 1981 deletions

View File

@@ -7,8 +7,8 @@ use brk_types::Height;
use tracing::warn;
use crate::{
BlkIndexToBlkPath, OUT_OF_ORDER_FILE_BACKOFF, XORBytes, XORIndex,
parse::HEADER_LEN, scan::find_magic,
BlkIndexToBlkPath, OUT_OF_ORDER_FILE_BACKOFF, XORBytes, XORIndex, parse::HEADER_LEN,
scan::find_magic,
};
const PROBE_BUF_LEN: usize = 4096;

View File

@@ -28,7 +28,9 @@ impl BlkIndexToBlkPath {
let Some(file_name) = path.file_name().and_then(|n| n.to_str()) else {
continue;
};
let Some(index_str) = file_name.strip_prefix(BLK).and_then(|s| s.strip_suffix(DOT_DAT))
let Some(index_str) = file_name
.strip_prefix(BLK)
.and_then(|s| s.strip_suffix(DOT_DAT))
else {
continue;
};

View File

@@ -47,8 +47,14 @@ pub(super) fn pipeline_forward(
}
drop(parser_recv);
let read_result =
read_and_dispatch(paths, first_blk_index, xor_bytes, canonical, &parser_send, &stop);
let read_result = read_and_dispatch(
paths,
first_blk_index,
xor_bytes,
canonical,
&parser_send,
&stop,
);
drop(parser_send);
read_result
})?;
@@ -125,8 +131,7 @@ fn read_and_dispatch(
else {
return ControlFlow::Continue(());
};
if !canonical
.verify_prev(canonical_offset, &BlockHash::from(header.prev_blockhash))
if !canonical.verify_prev(canonical_offset, &BlockHash::from(header.prev_blockhash))
{
let _ = stop.set(Stop::Failed(Error::Internal(
"forward pipeline: canonical batch stitched across a reorg",

View File

@@ -5,10 +5,7 @@ use brk_rpc::Client;
use brk_types::{Height, ReadBlock};
use crossbeam::channel::{Receiver, bounded};
use crate::{
BlkIndexToBlkPath, ReaderInner, XORBytes, bisect,
canonical::CanonicalRange,
};
use crate::{BlkIndexToBlkPath, ReaderInner, XORBytes, bisect, canonical::CanonicalRange};
mod forward;
mod reorder;

View File

@@ -74,9 +74,7 @@ pub(super) fn pipeline_tail(
if slots[offset as usize].is_some() {
return ControlFlow::Continue(());
}
if !canonical
.verify_prev(offset, &BlockHash::from(header.prev_blockhash))
{
if !canonical.verify_prev(offset, &BlockHash::from(header.prev_blockhash)) {
parse_failure = Some(Error::Internal(
"tail pipeline: canonical batch stitched across a reorg",
));