mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-20 06:44:47 -07:00
global: fixes
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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",
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user