bitview: reorg part 7 + fix hanging ?

This commit is contained in:
nym21
2025-09-28 20:33:55 +02:00
parent 9d03fdf31d
commit 7407c032e5
16 changed files with 581 additions and 495 deletions

View File

@@ -20,17 +20,18 @@ fn main() -> Result<()> {
let parser = Parser::new(bitcoin_dir.join("blocks"), rpc);
let start = Some(915_138_u32.into());
let start = None;
// let start = Some(916037_u32.into());
let end = None;
let mut blk_index = 0;
let mut diff = BTreeMap::new();
// let mut blk_index = 0;
// let mut diff = BTreeMap::new();
parser.parse(start, end).iter().for_each(|block| {
println!("{}: {}", block.height(), block.hash());
let new_blk_index = block.metadata().blk_index();
if new_blk_index < blk_index {
diff.insert(blk_index - new_blk_index, block.height());
}
blk_index = new_blk_index;
// let new_blk_index = block.metadata().blk_index();
// if new_blk_index < blk_index {
// diff.insert(blk_index - new_blk_index, block.height());
// }
// blk_index = new_blk_index;
});
// let v = diff.iter().rev().take(10).collect::<Vec<_>>();