mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-25 07:09:59 -07:00
global: MASSIVE snapshot
This commit is contained in:
@@ -15,13 +15,15 @@ impl Query {
|
||||
|
||||
let iter = DateIndexIter::new(computer, start, current_height.to_usize());
|
||||
|
||||
// KISS: dateindex.average.0 is now a concrete field
|
||||
let mut fees = computer
|
||||
.transactions
|
||||
.fees
|
||||
.indexes_to_fee
|
||||
.sats
|
||||
.dateindex
|
||||
.unwrap_average()
|
||||
.average
|
||||
.0
|
||||
.iter();
|
||||
|
||||
Ok(iter.collect(|di, ts, h| {
|
||||
|
||||
@@ -16,13 +16,16 @@ impl Query {
|
||||
let iter = DateIndexIter::new(computer, start, current_height.to_usize());
|
||||
|
||||
// coinbase = subsidy + fees
|
||||
// KISS: dateindex.distribution.average.0 is now a concrete field
|
||||
let mut rewards = computer
|
||||
.blocks
|
||||
.rewards
|
||||
.indexes_to_coinbase
|
||||
.sats
|
||||
.dateindex
|
||||
.unwrap_average()
|
||||
.distribution
|
||||
.average
|
||||
.0
|
||||
.iter();
|
||||
|
||||
Ok(iter.collect(|di, ts, h| {
|
||||
|
||||
@@ -20,14 +20,18 @@ impl Query {
|
||||
.size
|
||||
.indexes_to_block_size
|
||||
.dateindex
|
||||
.unwrap_average()
|
||||
.distribution
|
||||
.average
|
||||
.0
|
||||
.iter();
|
||||
let mut weights_vec = computer
|
||||
.blocks
|
||||
.weight
|
||||
.indexes_to_block_weight
|
||||
.dateindex
|
||||
.unwrap_average()
|
||||
.distribution
|
||||
.average
|
||||
.0
|
||||
.iter();
|
||||
|
||||
let entries: Vec<_> = iter.collect(|di, ts, h| {
|
||||
|
||||
@@ -52,8 +52,6 @@ impl<'a> DateIndexIter<'a> {
|
||||
.time
|
||||
.timeindexes_to_timestamp
|
||||
.dateindex
|
||||
.as_ref()
|
||||
.expect("timeindexes_to_timestamp.dateindex should exist")
|
||||
.iter();
|
||||
let mut heights = self.computer.indexes.time.dateindex_to_first_height.iter();
|
||||
|
||||
|
||||
@@ -21,14 +21,17 @@ pub fn iter_difficulty_epochs(
|
||||
.read_once(Height::from(end_height))
|
||||
.unwrap_or_default();
|
||||
|
||||
let mut epoch_to_height_iter = computer.indexes.block.difficultyepoch_to_first_height.iter();
|
||||
let mut epoch_to_height_iter = computer
|
||||
.indexes
|
||||
.block
|
||||
.difficultyepoch_to_first_height
|
||||
.iter();
|
||||
let mut epoch_to_timestamp_iter = computer.blocks.time.difficultyepoch_to_timestamp.iter();
|
||||
let mut epoch_to_difficulty_iter = computer
|
||||
.blocks
|
||||
.mining
|
||||
.indexes_to_difficulty
|
||||
.difficultyepoch
|
||||
.unwrap_last()
|
||||
.iter();
|
||||
|
||||
let mut results = Vec::with_capacity(end_epoch.to_usize() - start_epoch.to_usize() + 1);
|
||||
|
||||
@@ -30,7 +30,6 @@ impl Query {
|
||||
.mining
|
||||
.indexes_to_hash_rate
|
||||
.dateindex
|
||||
.unwrap_last()
|
||||
.read_once(current_dateindex)? as u128;
|
||||
|
||||
// Calculate start height based on time period
|
||||
@@ -61,7 +60,6 @@ impl Query {
|
||||
.mining
|
||||
.indexes_to_hash_rate
|
||||
.dateindex
|
||||
.unwrap_last()
|
||||
.iter();
|
||||
|
||||
let mut timestamp_iter = computer
|
||||
@@ -69,8 +67,6 @@ impl Query {
|
||||
.time
|
||||
.timeindexes_to_timestamp
|
||||
.dateindex
|
||||
.as_ref()
|
||||
.expect("timeindexes_to_timestamp.dateindex should exist")
|
||||
.iter();
|
||||
|
||||
let mut hashrates = Vec::with_capacity(total_days / step + 1);
|
||||
|
||||
@@ -32,8 +32,8 @@ impl Query {
|
||||
for (pool_id, pool_vecs) in &computer.pools.vecs {
|
||||
let mut cumulative = pool_vecs
|
||||
.indexes_to_blocks_mined
|
||||
.height_extra
|
||||
.unwrap_cumulative()
|
||||
.height_cumulative
|
||||
.inner()
|
||||
.iter();
|
||||
|
||||
let count_at_end: u32 = *cumulative.get(current_height).unwrap_or_default();
|
||||
@@ -102,8 +102,8 @@ impl Query {
|
||||
|
||||
let mut cumulative = pool_vecs
|
||||
.indexes_to_blocks_mined
|
||||
.height_extra
|
||||
.unwrap_cumulative()
|
||||
.height_cumulative
|
||||
.inner()
|
||||
.iter();
|
||||
|
||||
// Get total blocks (all time)
|
||||
|
||||
@@ -12,30 +12,30 @@ impl Query {
|
||||
let end_block = current_height;
|
||||
let start_block = Height::from(current_height.to_usize().saturating_sub(block_count - 1));
|
||||
|
||||
// KISS: height is now a concrete field (no Option)
|
||||
let mut coinbase_iter = computer
|
||||
.blocks
|
||||
.rewards
|
||||
.indexes_to_coinbase
|
||||
.sats
|
||||
.height
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.iter();
|
||||
// KISS: height.sum_cum.sum.0 is now a concrete field
|
||||
let mut fee_iter = computer
|
||||
.transactions
|
||||
.fees
|
||||
.indexes_to_fee
|
||||
.sats
|
||||
.height
|
||||
.unwrap_sum()
|
||||
.sum_cum
|
||||
.sum
|
||||
.0
|
||||
.iter();
|
||||
let mut tx_count_iter = computer
|
||||
.transactions
|
||||
.count
|
||||
.indexes_to_tx_count
|
||||
.height
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.iter();
|
||||
|
||||
let mut total_reward = Sats::ZERO;
|
||||
|
||||
Reference in New Issue
Block a user