mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 22:59:58 -07:00
global: wip
This commit is contained in:
@@ -4,6 +4,7 @@ description = "A Bitcoin dataset computer, built on top of brk_indexer"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
<a href="https://github.com/bitcoinresearchkit/brk">
|
||||
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/bitcoinresearchkit/brk?style=social">
|
||||
</a>
|
||||
<a href="https://kibo.money">
|
||||
<img alt="kibo.money" src="https://img.shields.io/badge/showcase-kib%C5%8D.money-orange">
|
||||
</a>
|
||||
<a href="https://github.com/bitcoinresearchkit/brk/blob/main/LICENSE.md">
|
||||
<img src="https://img.shields.io/crates/l/brk" alt="License" />
|
||||
</a>
|
||||
|
||||
@@ -18,6 +18,7 @@ pub mod stateful;
|
||||
pub mod transactions;
|
||||
|
||||
pub use indexes::Indexes;
|
||||
use log::info;
|
||||
|
||||
const VERSION: Version = Version::ONE;
|
||||
|
||||
@@ -119,16 +120,20 @@ impl Vecs {
|
||||
) -> color_eyre::Result<()> {
|
||||
let starting_indexes = self.indexes.compute(indexer, starting_indexes, exit)?;
|
||||
|
||||
info!("Computing constants...");
|
||||
self.constants
|
||||
.compute(indexer, &self.indexes, &starting_indexes, exit)?;
|
||||
|
||||
info!("Computing blocks...");
|
||||
self.blocks
|
||||
.compute(indexer, &self.indexes, &starting_indexes, exit)?;
|
||||
|
||||
info!("Computing mining...");
|
||||
self.mining
|
||||
.compute(indexer, &self.indexes, &starting_indexes, exit)?;
|
||||
|
||||
if let Some(fetched) = self.fetched.as_mut() {
|
||||
info!("Computing fetched...");
|
||||
fetched.compute(
|
||||
indexer,
|
||||
&self.indexes,
|
||||
@@ -138,6 +143,7 @@ impl Vecs {
|
||||
)?;
|
||||
}
|
||||
|
||||
info!("Computing transactions...");
|
||||
self.transactions.compute(
|
||||
indexer,
|
||||
&self.indexes,
|
||||
@@ -147,6 +153,7 @@ impl Vecs {
|
||||
)?;
|
||||
|
||||
if let Some(fetched) = self.fetched.as_ref() {
|
||||
info!("Computing market...");
|
||||
self.market.compute(
|
||||
indexer,
|
||||
&self.indexes,
|
||||
@@ -157,6 +164,7 @@ impl Vecs {
|
||||
)?;
|
||||
}
|
||||
|
||||
info!("Computing stateful...");
|
||||
self.stateful.compute(
|
||||
indexer,
|
||||
&self.indexes,
|
||||
|
||||
@@ -895,21 +895,17 @@ impl Vecs {
|
||||
path,
|
||||
&suffix("coinblocks_destroyed"),
|
||||
true,
|
||||
version + VERSION + Version::ZERO,
|
||||
version + VERSION + Version::ONE,
|
||||
format,
|
||||
StorableVecGeneatorOptions::default()
|
||||
.add_sum()
|
||||
.add_cumulative(),
|
||||
StorableVecGeneatorOptions::default().add_sum(),
|
||||
)?,
|
||||
indexes_to_coindays_destroyed: ComputedVecsFromHeight::forced_import(
|
||||
path,
|
||||
&suffix("coindays_destroyed"),
|
||||
true,
|
||||
version + VERSION + Version::ZERO,
|
||||
version + VERSION + Version::ONE,
|
||||
format,
|
||||
StorableVecGeneatorOptions::default()
|
||||
.add_sum()
|
||||
.add_cumulative(),
|
||||
StorableVecGeneatorOptions::default().add_sum(),
|
||||
)?,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1388,7 +1388,7 @@ impl Vecs {
|
||||
+ dateindex_to_height_count.version();
|
||||
|
||||
separate_utxo_vecs
|
||||
.iter_mut()
|
||||
.par_iter_mut()
|
||||
.try_for_each(|(_, v)| v.validate_computed_versions(base_version))?;
|
||||
self.height_to_unspendable_supply
|
||||
.validate_computed_version_or_reset_file(
|
||||
@@ -1403,7 +1403,7 @@ impl Vecs {
|
||||
let mut chain_state_starting_height = Height::from(self.chain_state.len());
|
||||
|
||||
let stateful_starting_height = match separate_utxo_vecs
|
||||
.iter_mut()
|
||||
.par_iter_mut()
|
||||
.map(|(_, v)| v.starting_height())
|
||||
.min()
|
||||
.unwrap_or_default()
|
||||
@@ -1442,7 +1442,7 @@ impl Vecs {
|
||||
if stateful_starting_height.is_zero() {
|
||||
info!("Starting processing utxos from the start");
|
||||
separate_utxo_vecs
|
||||
.iter_mut()
|
||||
.par_iter_mut()
|
||||
.try_for_each(|(_, v)| v.state.price_to_amount.reset_partition())?;
|
||||
}
|
||||
let starting_height = starting_indexes
|
||||
@@ -1451,12 +1451,16 @@ impl Vecs {
|
||||
.min(Height::from(self.height_to_unspendable_supply.len()))
|
||||
.min(Height::from(self.height_to_opreturn_supply.len()));
|
||||
|
||||
if starting_height == Height::from(height_to_date_fixed.len()) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// ---
|
||||
// INIT
|
||||
// ---
|
||||
|
||||
separate_utxo_vecs
|
||||
.iter_mut()
|
||||
.par_iter_mut()
|
||||
.for_each(|(_, v)| v.init(starting_height));
|
||||
|
||||
let mut unspendable_supply = if let Some(prev_height) = starting_height.decremented() {
|
||||
@@ -1703,10 +1707,12 @@ impl Vecs {
|
||||
|
||||
self.flush_states(height, &chain_state, exit)?;
|
||||
|
||||
info!("Computing overlaping...");
|
||||
|
||||
self.utxos_vecs
|
||||
.compute_overlaping_vecs(&starting_indexes, exit)?;
|
||||
|
||||
info!("Computing rest...");
|
||||
info!("Computing rest part 1...");
|
||||
|
||||
self.utxos_vecs
|
||||
.as_mut_vecs()
|
||||
@@ -1714,6 +1720,9 @@ impl Vecs {
|
||||
.try_for_each(|(_, v)| {
|
||||
v.compute_rest_part1(indexer, indexes, fetched, &starting_indexes, exit)
|
||||
})?;
|
||||
|
||||
info!("Computing rest part 2...");
|
||||
|
||||
let height_to_supply = self.utxos_vecs.all.1.height_to_supply_value.bitcoin.clone();
|
||||
let dateindex_to_supply = self
|
||||
.utxos_vecs
|
||||
@@ -1724,6 +1733,7 @@ impl Vecs {
|
||||
.dateindex
|
||||
.clone();
|
||||
let height_to_realized_cap = self.utxos_vecs.all.1.height_to_realized_cap.clone();
|
||||
|
||||
self.utxos_vecs
|
||||
.as_mut_vecs()
|
||||
.par_iter_mut()
|
||||
|
||||
Reference in New Issue
Block a user