mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-10 14:19:10 -07:00
Docker functionality, change location of 'blk_index_to_blk_recap.json'
This commit is contained in:
@@ -16,7 +16,7 @@ pub fn run() -> color_eyre::Result<()> {
|
||||
|
||||
let exit = Exit::new();
|
||||
|
||||
let parser = brk_parser::Parser::new(config.blocksdir(), rpc);
|
||||
let parser = brk_parser::Parser::new_with_outputs_dir(config.blocksdir(), config.outputsdir(), rpc);
|
||||
|
||||
let format = config.format();
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@ pub struct BlkIndexToBlkRecap {
|
||||
|
||||
impl BlkIndexToBlkRecap {
|
||||
pub fn import(
|
||||
bitcoin_dir: &Path,
|
||||
outputs_dir: &Path,
|
||||
blk_index_to_blk_path: &BlkIndexToBlkPath,
|
||||
start: Option<Height>,
|
||||
) -> (Self, u16) {
|
||||
let path = bitcoin_dir.join("blk_index_to_blk_recap.json");
|
||||
let path = outputs_dir.join("blk_index_to_blk_recap.json");
|
||||
|
||||
let tree = {
|
||||
if let Ok(file) = File::open(&path) {
|
||||
|
||||
@@ -38,12 +38,22 @@ const BOUND_CAP: usize = 50;
|
||||
|
||||
pub struct Parser {
|
||||
blocks_dir: PathBuf,
|
||||
outputs_dir: PathBuf,
|
||||
rpc: &'static bitcoincore_rpc::Client,
|
||||
}
|
||||
|
||||
impl Parser {
|
||||
pub fn new(blocks_dir: PathBuf, rpc: &'static bitcoincore_rpc::Client) -> Self {
|
||||
Self { blocks_dir, rpc }
|
||||
// For backward compatibility, use blocks_dir as outputs_dir
|
||||
Self {
|
||||
outputs_dir: blocks_dir.clone(),
|
||||
blocks_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 {
|
||||
@@ -74,7 +84,7 @@ impl Parser {
|
||||
let blk_index_to_blk_path = BlkIndexToBlkPath::scan(blocks_dir);
|
||||
|
||||
let (mut blk_index_to_blk_recap, blk_index) =
|
||||
BlkIndexToBlkRecap::import(blocks_dir, &blk_index_to_blk_path, start);
|
||||
BlkIndexToBlkRecap::import(&self.outputs_dir, &blk_index_to_blk_path, start);
|
||||
|
||||
let xor_bytes = XORBytes::from(blocks_dir);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user