mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 22:59:58 -07:00
global: snapshot
This commit is contained in:
@@ -124,7 +124,7 @@ impl Vecs {
|
||||
)?;
|
||||
|
||||
// Supply-Adjusted Dormancy = dormancy / circulating_supply_btc
|
||||
self.dormancy_supply_adjusted
|
||||
self.dormancy.supply_adjusted
|
||||
.height
|
||||
.compute_transform2(
|
||||
starting_indexes.height,
|
||||
@@ -161,7 +161,7 @@ impl Vecs {
|
||||
)?;
|
||||
|
||||
// Dormancy Flow: supply_btc / dormancy
|
||||
self.dormancy_flow.height.compute_transform2(
|
||||
self.dormancy.flow.height.compute_transform2(
|
||||
starting_indexes.height,
|
||||
supply_total_sats,
|
||||
&all_activity.dormancy.height,
|
||||
|
||||
@@ -18,7 +18,7 @@ pub(super) fn compute(
|
||||
.collect();
|
||||
let count_vecs: Vec<&_> = amount_range
|
||||
.iter()
|
||||
.map(|c| &c.metrics.outputs.utxo_count.height)
|
||||
.map(|c| &c.metrics.outputs.unspent_count.height)
|
||||
.collect();
|
||||
|
||||
if supply_vecs.is_empty() || supply_vecs.len() != count_vecs.len() {
|
||||
|
||||
@@ -30,10 +30,11 @@ impl Vecs {
|
||||
ComputedPerBlock::forced_import(&db, "coindays_destroyed_supply_adjusted", v, indexes)?;
|
||||
let coinyears_destroyed_supply_adjusted =
|
||||
ComputedPerBlock::forced_import(&db, "coinyears_destroyed_supply_adjusted", v, indexes)?;
|
||||
let dormancy_supply_adjusted =
|
||||
ComputedPerBlock::forced_import(&db, "dormancy_supply_adjusted", v, indexes)?;
|
||||
let dormancy = super::vecs::DormancyVecs {
|
||||
supply_adjusted: ComputedPerBlock::forced_import(&db, "dormancy_supply_adjusted", v, indexes)?,
|
||||
flow: ComputedPerBlock::forced_import(&db, "dormancy_flow", v, indexes)?,
|
||||
};
|
||||
let stock_to_flow = ComputedPerBlock::forced_import(&db, "stock_to_flow", v, indexes)?;
|
||||
let dormancy_flow = ComputedPerBlock::forced_import(&db, "dormancy_flow", v, indexes)?;
|
||||
let seller_exhaustion_constant =
|
||||
ComputedPerBlock::forced_import(&db, "seller_exhaustion_constant", v, indexes)?;
|
||||
|
||||
@@ -46,9 +47,8 @@ impl Vecs {
|
||||
thermocap_multiple,
|
||||
coindays_destroyed_supply_adjusted,
|
||||
coinyears_destroyed_supply_adjusted,
|
||||
dormancy_supply_adjusted,
|
||||
dormancy,
|
||||
stock_to_flow,
|
||||
dormancy_flow,
|
||||
seller_exhaustion_constant,
|
||||
};
|
||||
finalize_db(&this.db, &this)?;
|
||||
|
||||
@@ -4,6 +4,12 @@ use vecdb::{Database, Rw, StorageMode};
|
||||
|
||||
use crate::internal::{ComputedPerBlock, PercentPerBlock, RatioPerBlock};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct DormancyVecs<M: StorageMode = Rw> {
|
||||
pub supply_adjusted: ComputedPerBlock<StoredF32, M>,
|
||||
pub flow: ComputedPerBlock<StoredF32, M>,
|
||||
}
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
#[traversable(skip)]
|
||||
@@ -15,8 +21,7 @@ pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub thermocap_multiple: RatioPerBlock<BasisPoints32, M>,
|
||||
pub coindays_destroyed_supply_adjusted: ComputedPerBlock<StoredF32, M>,
|
||||
pub coinyears_destroyed_supply_adjusted: ComputedPerBlock<StoredF32, M>,
|
||||
pub dormancy_supply_adjusted: ComputedPerBlock<StoredF32, M>,
|
||||
pub dormancy: DormancyVecs<M>,
|
||||
pub stock_to_flow: ComputedPerBlock<StoredF32, M>,
|
||||
pub dormancy_flow: ComputedPerBlock<StoredF32, M>,
|
||||
pub seller_exhaustion_constant: ComputedPerBlock<StoredF32, M>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user