mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-29 20:59:27 -07:00
global: snapshot + lock file + better errors
This commit is contained in:
@@ -5,7 +5,7 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use crate::{blk_recap::BlkRecap, BlkIndexToBlkPath, Height};
|
||||
use crate::{BlkIndexToBlkPath, Height, blk_recap::BlkRecap};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct BlkIndexToBlkRecap {
|
||||
@@ -48,12 +48,12 @@ impl BlkIndexToBlkRecap {
|
||||
.iter()
|
||||
.for_each(|(blk_index, blk_path)| {
|
||||
unprocessed_keys.remove(blk_index);
|
||||
if let Some(blk_recap) = self.tree.get(blk_index) {
|
||||
if blk_recap.has_different_modified_time(blk_path) {
|
||||
self.tree.remove(blk_index).unwrap();
|
||||
if min_removed_blk_index.is_none_or(|_blk_index| *blk_index < _blk_index) {
|
||||
min_removed_blk_index.replace(*blk_index);
|
||||
}
|
||||
if let Some(blk_recap) = self.tree.get(blk_index)
|
||||
&& blk_recap.has_different_modified_time(blk_path)
|
||||
{
|
||||
self.tree.remove(blk_index).unwrap();
|
||||
if min_removed_blk_index.is_none_or(|_blk_index| *blk_index < _blk_index) {
|
||||
min_removed_blk_index.replace(*blk_index);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -85,10 +85,10 @@ impl BlkIndexToBlkRecap {
|
||||
start = Some(*found.0);
|
||||
}
|
||||
|
||||
if let Some(min_removed) = min_removed {
|
||||
if start.is_none_or(|start| start > min_removed) {
|
||||
start = Some(min_removed);
|
||||
}
|
||||
if let Some(min_removed) = min_removed
|
||||
&& start.is_none_or(|start| start > min_removed)
|
||||
{
|
||||
start = Some(min_removed);
|
||||
}
|
||||
|
||||
// Should only be none if asking for a too high start
|
||||
|
||||
Reference in New Issue
Block a user