parser: fix defrag

This commit is contained in:
k
2024-10-31 09:57:06 +01:00
parent 530d4ce717
commit 647a51af15
3 changed files with 10 additions and 10 deletions

View File

@@ -69,7 +69,7 @@ where
btree::iter(&self.txn, &self.db, None).unwrap()
}
fn iter_collect(&self) -> BTreeMap<Key, Value>
pub fn iter_collect(&self) -> BTreeMap<Key, Value>
where
Value: Clone,
{
@@ -244,14 +244,10 @@ where
let mut s = Self::open(&folder, &file).unwrap();
if !s.is_empty() {
dbg!(s.len());
panic!("Database isn't empty");
if s.is_empty() {
s.cached_puts = btree;
s.export().unwrap();
}
s.db_multi_put(btree).unwrap();
s.export().unwrap();
}
}

View File

@@ -9,10 +9,11 @@ mod utils;
pub use crate::{
actions::iter_blocks,
databases::{AnyDatabase, Database},
io::{Binary, Json, Serialization, COMPRESSED_BIN_EXTENSION, JSON_EXTENSION},
structs::{
Config, Date, DateMap, Exit, Height, HeightMap, MapChunkId, MapValue, SerializedBTreeMap,
SerializedVec, HEIGHT_MAP_CHUNK_SIZE, OHLC,
Amount, Config, Date, DateMap, Exit, Height, HeightMap, MapChunkId, MapValue,
SerializedBTreeMap, SerializedVec, TxoutIndex, HEIGHT_MAP_CHUNK_SIZE, OHLC,
},
utils::{create_rpc, log, reset_logs},
};