mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-26 07:39:59 -07:00
computer: add positions
This commit is contained in:
@@ -1,18 +1,40 @@
|
||||
use std::path::Path;
|
||||
use std::{fs, path::Path};
|
||||
|
||||
use brk_computer::Computer;
|
||||
use brk_error::Result;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_interface::{Index, Interface, Params, ParamsOpt};
|
||||
use brk_parser::Parser;
|
||||
use vecdb::Exit;
|
||||
|
||||
pub fn main() -> Result<()> {
|
||||
let outputs_dir = Path::new("../../_outputs");
|
||||
let bitcoin_dir = Path::new(&std::env::var("HOME").unwrap())
|
||||
.join("Library")
|
||||
.join("Application Support")
|
||||
.join("Bitcoin");
|
||||
// let bitcoin_dir = Path::new("/Volumes/WD_BLACK1/bitcoin");
|
||||
|
||||
let indexer = Indexer::forced_import(outputs_dir)?;
|
||||
let blocks_dir = bitcoin_dir.join("blocks");
|
||||
|
||||
let computer = Computer::forced_import(outputs_dir, &indexer, None)?;
|
||||
let outputs_dir = Path::new(&std::env::var("HOME").unwrap()).join(".brk");
|
||||
fs::create_dir_all(&outputs_dir)?;
|
||||
// let outputs_dir = Path::new("/Volumes/WD_BLACK1/brk");
|
||||
|
||||
let interface = Interface::build(&indexer, &computer);
|
||||
let rpc = Box::leak(Box::new(bitcoincore_rpc::Client::new(
|
||||
"http://localhost:8332",
|
||||
bitcoincore_rpc::Auth::CookieFile(bitcoin_dir.join(".cookie")),
|
||||
)?));
|
||||
|
||||
let exit = Exit::new();
|
||||
exit.set_ctrlc_handler();
|
||||
|
||||
let parser = Parser::new(blocks_dir, rpc);
|
||||
|
||||
let indexer = Indexer::forced_import(&outputs_dir)?;
|
||||
|
||||
let computer = Computer::forced_import(&outputs_dir, &indexer, None)?;
|
||||
|
||||
let interface = Interface::build(&parser, &indexer, &computer);
|
||||
|
||||
dbg!(interface.search_and_format(Params {
|
||||
index: Index::Height,
|
||||
|
||||
Reference in New Issue
Block a user