mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-07 20:59:09 -07:00
37 lines
831 B
Rust
37 lines
831 B
Rust
use std::path::Path;
|
|
|
|
use brk_core::{default_bitcoin_path, dot_brk_path};
|
|
use brk_exit::Exit;
|
|
use brk_indexer::Indexer;
|
|
use brk_parser::{
|
|
Parser,
|
|
rpc::{self},
|
|
};
|
|
|
|
fn main() -> color_eyre::Result<()> {
|
|
color_eyre::install()?;
|
|
|
|
brk_logger::init(Some(Path::new(".log")));
|
|
|
|
let bitcoin_dir = default_bitcoin_path();
|
|
|
|
let rpc = Box::leak(Box::new(rpc::Client::new(
|
|
"http://localhost:8332",
|
|
rpc::Auth::CookieFile(bitcoin_dir.join(".cookie")),
|
|
)?));
|
|
let exit = Exit::new();
|
|
|
|
let parser = Parser::new(bitcoin_dir.join("blocks"), rpc);
|
|
|
|
let outputs = dot_brk_path().join("outputs");
|
|
|
|
let mut indexer = Indexer::new(outputs.join("indexed").to_owned(), true, true)?;
|
|
|
|
indexer.import_stores()?;
|
|
indexer.import_vecs()?;
|
|
|
|
indexer.index(&parser, rpc, &exit)?;
|
|
|
|
Ok(())
|
|
}
|