mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
binder: commit generated clients
This commit is contained in:
@@ -40,23 +40,6 @@ fn run() -> Result<()> {
|
||||
|
||||
brk_logger::init(Some(&outputs_dir.join("log")))?;
|
||||
|
||||
let client = Client::new(
|
||||
Client::default_url(),
|
||||
Auth::CookieFile(bitcoin_dir.join(".cookie")),
|
||||
)?;
|
||||
|
||||
let reader = Reader::new(bitcoin_dir.join("blocks"), &client);
|
||||
|
||||
let blocks = Blocks::new(&client, &reader);
|
||||
|
||||
let mut indexer = Indexer::forced_import(&outputs_dir)?;
|
||||
|
||||
let fetcher = Fetcher::import(true, None)?;
|
||||
|
||||
info!("Ping: {:?}", fetcher.brk.ping()?);
|
||||
|
||||
let mut computer = Computer::forced_import(&outputs_dir, &indexer, Some(fetcher))?;
|
||||
|
||||
let mut bencher = Bencher::from_cargo_env("brk", &outputs_dir)?;
|
||||
bencher.start()?;
|
||||
|
||||
@@ -68,6 +51,33 @@ fn run() -> Result<()> {
|
||||
debug!("Bench stopped.");
|
||||
});
|
||||
|
||||
let client = Client::new(
|
||||
Client::default_url(),
|
||||
Auth::CookieFile(bitcoin_dir.join(".cookie")),
|
||||
)?;
|
||||
|
||||
let reader = Reader::new(bitcoin_dir.join("blocks"), &client);
|
||||
|
||||
let blocks = Blocks::new(&client, &reader);
|
||||
|
||||
let fetcher = Fetcher::import(true, None)?;
|
||||
|
||||
info!("Ping: {:?}", fetcher.brk.ping()?);
|
||||
|
||||
let mut indexer = Indexer::forced_import(&outputs_dir)?;
|
||||
|
||||
// Pre-run indexer if too far behind, then drop and reimport to reduce memory
|
||||
let chain_height = client.get_last_height()?;
|
||||
let indexed_height = indexer.vecs.starting_height();
|
||||
if chain_height.saturating_sub(*indexed_height) > 1000 {
|
||||
indexer.index(&blocks, &client, &exit)?;
|
||||
drop(indexer);
|
||||
Mimalloc::collect();
|
||||
indexer = Indexer::forced_import(&outputs_dir)?;
|
||||
}
|
||||
|
||||
let mut computer = Computer::forced_import(&outputs_dir, &indexer, Some(fetcher))?;
|
||||
|
||||
loop {
|
||||
let i = Instant::now();
|
||||
let starting_indexes = indexer.index(&blocks, &client, &exit)?;
|
||||
|
||||
@@ -14,7 +14,7 @@ pub use readers::{
|
||||
pub use recover::{StartMode, determine_start_mode, recover_state, reset_state};
|
||||
|
||||
/// Flush checkpoint interval (every N blocks).
|
||||
pub const FLUSH_INTERVAL: usize = 10_000;
|
||||
pub const FLUSH_INTERVAL: usize = 20_000;
|
||||
|
||||
// BIP30 duplicate coinbase heights (special case handling)
|
||||
pub const BIP30_DUPLICATE_HEIGHT_1: u32 = 91_842;
|
||||
|
||||
@@ -12,7 +12,7 @@ use vecdb::{
|
||||
|
||||
use super::Indexes;
|
||||
|
||||
const BATCH_SIZE: usize = 2 * 1024 * 1024 * 1024 / size_of::<Entry>();
|
||||
const BATCH_SIZE: usize = 3 * 1024 * 1024 * 1024 / size_of::<Entry>();
|
||||
pub const DB_NAME: &str = "txins";
|
||||
|
||||
#[derive(Clone, Traversable)]
|
||||
|
||||
@@ -101,7 +101,7 @@ impl Vecs {
|
||||
starting_indexes.height
|
||||
);
|
||||
|
||||
const HEIGHT_BATCH: u32 = 10_000;
|
||||
const HEIGHT_BATCH: u32 = 20_000;
|
||||
let mut pairs: Vec<(TxOutIndex, TxInIndex)> = Vec::new();
|
||||
|
||||
let mut batch_start_height = min_height;
|
||||
|
||||
Reference in New Issue
Block a user