Make Parser::new the only entrypoint

This commit is contained in:
deadmanoz
2025-07-04 12:15:32 +08:00
parent 870c70180f
commit fa1e5aaa7f
8 changed files with 18 additions and 19 deletions

View File

@@ -5,7 +5,7 @@ use std::{
path::{Path, PathBuf},
};
use crate::{BlkIndexToBlkPath, Height, blk_recap::BlkRecap};
use crate::{blk_recap::BlkRecap, BlkIndexToBlkPath, Height};
#[derive(Debug)]
pub struct BlkIndexToBlkRecap {

View File

@@ -43,18 +43,13 @@ pub struct Parser {
}
impl Parser {
pub fn new(blocks_dir: PathBuf, rpc: &'static bitcoincore_rpc::Client) -> Self {
// For backward compatibility, use blocks_dir as outputs_dir
pub fn new(blocks_dir: PathBuf, brk_dir: PathBuf, rpc: &'static bitcoincore_rpc::Client) -> Self {
Self {
outputs_dir: blocks_dir.clone(),
blocks_dir,
blocks_dir,
outputs_dir: brk_dir,
rpc
}
}
pub fn new_with_outputs_dir(blocks_dir: PathBuf, outputs_dir: PathBuf, rpc: &'static bitcoincore_rpc::Client) -> Self {
Self { blocks_dir, outputs_dir, rpc }
}
pub fn get(&self, height: Height) -> Block {
self.parse(Some(height), Some(height))