mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-02 10:30:00 -07:00
computer: snapshot
This commit is contained in:
@@ -22,7 +22,7 @@ impl Vecs {
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
let window_starts = blocks.count.window_starts();
|
||||
let window_starts = blocks.lookback.window_starts();
|
||||
|
||||
self.sent_sum.compute(
|
||||
starting_indexes.height,
|
||||
@@ -60,7 +60,7 @@ impl Vecs {
|
||||
// Annualized volume: rolling 1y sum of per-block sent volume
|
||||
self.annualized_volume.sats.height.compute_rolling_sum(
|
||||
starting_indexes.height,
|
||||
&blocks.count.height_1y_ago,
|
||||
&blocks.lookback.height_1y_ago,
|
||||
&self.sent_sum.sats,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
@@ -5,7 +5,7 @@ use vecdb::Database;
|
||||
use super::Vecs;
|
||||
use crate::{
|
||||
indexes,
|
||||
internal::{ComputedFromHeight, ValueFromHeight, ValueFromHeightRolling},
|
||||
internal::{AmountFromHeight, AmountFromHeightRolling, ComputedFromHeight},
|
||||
};
|
||||
|
||||
impl Vecs {
|
||||
@@ -16,14 +16,14 @@ impl Vecs {
|
||||
) -> Result<Self> {
|
||||
let v2 = Version::TWO;
|
||||
Ok(Self {
|
||||
sent_sum: ValueFromHeightRolling::forced_import(db, "sent_sum", version, indexes)?,
|
||||
received_sum: ValueFromHeightRolling::forced_import(
|
||||
sent_sum: AmountFromHeightRolling::forced_import(db, "sent_sum", version, indexes)?,
|
||||
received_sum: AmountFromHeightRolling::forced_import(
|
||||
db,
|
||||
"received_sum",
|
||||
version,
|
||||
indexes,
|
||||
)?,
|
||||
annualized_volume: ValueFromHeight::forced_import(
|
||||
annualized_volume: AmountFromHeight::forced_import(
|
||||
db,
|
||||
"annualized_volume",
|
||||
version,
|
||||
|
||||
@@ -2,13 +2,13 @@ use brk_traversable::Traversable;
|
||||
use brk_types::StoredF32;
|
||||
use vecdb::{Rw, StorageMode};
|
||||
|
||||
use crate::internal::{ComputedFromHeight, ValueFromHeight, ValueFromHeightRolling};
|
||||
use crate::internal::{AmountFromHeight, AmountFromHeightRolling, ComputedFromHeight};
|
||||
|
||||
#[derive(Traversable)]
|
||||
pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub sent_sum: ValueFromHeightRolling<M>,
|
||||
pub received_sum: ValueFromHeightRolling<M>,
|
||||
pub annualized_volume: ValueFromHeight<M>,
|
||||
pub sent_sum: AmountFromHeightRolling<M>,
|
||||
pub received_sum: AmountFromHeightRolling<M>,
|
||||
pub annualized_volume: AmountFromHeight<M>,
|
||||
pub tx_per_sec: ComputedFromHeight<StoredF32, M>,
|
||||
pub outputs_per_sec: ComputedFromHeight<StoredF32, M>,
|
||||
pub inputs_per_sec: ComputedFromHeight<StoredF32, M>,
|
||||
|
||||
Reference in New Issue
Block a user