mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-24 17:38:09 -07:00
global: fmt
This commit is contained in:
@@ -14,23 +14,23 @@ impl Vecs {
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
self.total.compute_with(
|
||||
starting_indexes.height,
|
||||
prices,
|
||||
exit,
|
||||
|sats| {
|
||||
self.total
|
||||
.compute_with(starting_indexes.height, prices, exit, |sats| {
|
||||
Ok(sats.compute_transform2(
|
||||
starting_indexes.height,
|
||||
&scripts.value.op_return.block.sats,
|
||||
&mining.rewards.unclaimed.block.sats,
|
||||
|(h, op_return, unclaimed, ..)| {
|
||||
let genesis = if h.to_usize() == 0 { Sats::FIFTY_BTC } else { Sats::ZERO };
|
||||
let genesis = if h.to_usize() == 0 {
|
||||
Sats::FIFTY_BTC
|
||||
} else {
|
||||
Sats::ZERO
|
||||
};
|
||||
(h, genesis + op_return + unclaimed)
|
||||
},
|
||||
exit,
|
||||
)?)
|
||||
},
|
||||
)?;
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -24,13 +24,8 @@ impl Vecs {
|
||||
self.db.sync_bg_tasks()?;
|
||||
|
||||
// 1. Compute burned/unspendable supply
|
||||
self.burned.compute(
|
||||
scripts,
|
||||
mining,
|
||||
prices,
|
||||
starting_indexes,
|
||||
exit,
|
||||
)?;
|
||||
self.burned
|
||||
.compute(scripts, mining, prices, starting_indexes, exit)?;
|
||||
|
||||
// 2. Compute inflation rate: (supply[h] / supply[1y_ago]) - 1
|
||||
// Skip when lookback supply <= first block (50 BTC = 5B sats),
|
||||
|
||||
@@ -6,8 +6,8 @@ use brk_types::Version;
|
||||
use crate::{
|
||||
cointime, distribution, indexes,
|
||||
internal::{
|
||||
CachedWindowStarts, LazyAmountPerBlock, LazyFiatPerBlock,
|
||||
LazyRollingDeltasFiatFromHeight, PercentPerBlock, RollingWindows,
|
||||
CachedWindowStarts, LazyAmountPerBlock, LazyFiatPerBlock, LazyRollingDeltasFiatFromHeight,
|
||||
PercentPerBlock, RollingWindows,
|
||||
db_utils::{finalize_db, open_db},
|
||||
},
|
||||
supply::burned,
|
||||
@@ -37,12 +37,8 @@ impl Vecs {
|
||||
let burned = burned::Vecs::forced_import(&db, version, indexes)?;
|
||||
|
||||
// Inflation rate
|
||||
let inflation_rate = PercentPerBlock::forced_import(
|
||||
&db,
|
||||
"inflation_rate",
|
||||
version + Version::ONE,
|
||||
indexes,
|
||||
)?;
|
||||
let inflation_rate =
|
||||
PercentPerBlock::forced_import(&db, "inflation_rate", version + Version::ONE, indexes)?;
|
||||
|
||||
// Velocity
|
||||
let velocity = super::velocity::Vecs::forced_import(&db, version, indexes)?;
|
||||
@@ -67,8 +63,11 @@ impl Vecs {
|
||||
indexes,
|
||||
)?;
|
||||
|
||||
let hodled_or_lost =
|
||||
LazyAmountPerBlock::identity("hodled_or_lost_supply", &cointime.supply.vaulted, version);
|
||||
let hodled_or_lost = LazyAmountPerBlock::identity(
|
||||
"hodled_or_lost_supply",
|
||||
&cointime.supply.vaulted,
|
||||
version,
|
||||
);
|
||||
|
||||
let this = Self {
|
||||
db,
|
||||
|
||||
@@ -4,8 +4,8 @@ use vecdb::{Database, Rw, StorageMode};
|
||||
|
||||
use super::{burned, velocity};
|
||||
use crate::internal::{
|
||||
LazyFiatPerBlock, LazyAmountPerBlock, LazyRollingDeltasFiatFromHeight,
|
||||
PercentPerBlock, RollingWindows,
|
||||
LazyAmountPerBlock, LazyFiatPerBlock, LazyRollingDeltasFiatFromHeight, PercentPerBlock,
|
||||
RollingWindows,
|
||||
};
|
||||
|
||||
#[derive(Traversable)]
|
||||
|
||||
Reference in New Issue
Block a user