mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-25 23:29:58 -07:00
global: MASSIVE snapshot
This commit is contained in:
@@ -53,19 +53,19 @@ impl Query {
|
||||
};
|
||||
|
||||
let any_address_index = computer
|
||||
.stateful
|
||||
.distribution
|
||||
.any_address_indexes
|
||||
.get_once(outputtype, type_index)?;
|
||||
|
||||
let address_data = match any_address_index.to_enum() {
|
||||
AnyAddressDataIndexEnum::Loaded(index) => computer
|
||||
.stateful
|
||||
.distribution
|
||||
.addresses_data
|
||||
.loaded
|
||||
.iter()?
|
||||
.get_unwrap(index),
|
||||
AnyAddressDataIndexEnum::Empty(index) => computer
|
||||
.stateful
|
||||
.distribution
|
||||
.addresses_data
|
||||
.empty
|
||||
.iter()?
|
||||
|
||||
@@ -27,7 +27,7 @@ impl Query {
|
||||
return Err(Error::OutOfRange("Block height out of range".into()));
|
||||
}
|
||||
|
||||
let position = computer.blks.height_to_position.read_once(height)?;
|
||||
let position = computer.positions.height_to_position.read_once(height)?;
|
||||
let size = indexer.vecs.block.height_to_total_size.read_once(height)?;
|
||||
|
||||
reader.read_raw_bytes(position, *size as usize)
|
||||
|
||||
@@ -32,7 +32,7 @@ impl Query {
|
||||
//
|
||||
// let iter = DateIndexIter::new(computer, start, current_height.to_usize());
|
||||
//
|
||||
// let vecs = &computer.chain.indexes_to_fee_rate.dateindex;
|
||||
// let vecs = &computer.transactions.transaction.indexes_to_fee_rate.dateindex;
|
||||
// let mut min = vecs.unwrap_min().iter();
|
||||
// let mut pct10 = vecs.unwrap_pct10().iter();
|
||||
// let mut pct25 = vecs.unwrap_pct25().iter();
|
||||
|
||||
@@ -16,8 +16,8 @@ impl Query {
|
||||
let iter = DateIndexIter::new(computer, start, current_height.to_usize());
|
||||
|
||||
let mut fees = computer
|
||||
.chain
|
||||
.transaction
|
||||
.transactions
|
||||
.fees
|
||||
.indexes_to_fee
|
||||
.sats
|
||||
.dateindex
|
||||
|
||||
@@ -17,8 +17,8 @@ impl Query {
|
||||
|
||||
// coinbase = subsidy + fees
|
||||
let mut rewards = computer
|
||||
.chain
|
||||
.coinbase
|
||||
.blocks
|
||||
.rewards
|
||||
.indexes_to_coinbase
|
||||
.sats
|
||||
.dateindex
|
||||
|
||||
@@ -16,15 +16,15 @@ impl Query {
|
||||
let iter = DateIndexIter::new(computer, start, current_height.to_usize());
|
||||
|
||||
let mut sizes_vec = computer
|
||||
.chain
|
||||
.block
|
||||
.blocks
|
||||
.size
|
||||
.indexes_to_block_size
|
||||
.dateindex
|
||||
.unwrap_average()
|
||||
.iter();
|
||||
let mut weights_vec = computer
|
||||
.chain
|
||||
.block
|
||||
.blocks
|
||||
.weight
|
||||
.indexes_to_block_weight
|
||||
.dateindex
|
||||
.unwrap_average()
|
||||
|
||||
@@ -48,8 +48,8 @@ impl<'a> DateIndexIter<'a> {
|
||||
+ 1;
|
||||
let mut timestamps = self
|
||||
.computer
|
||||
.chain
|
||||
.block
|
||||
.blocks
|
||||
.time
|
||||
.timeindexes_to_timestamp
|
||||
.dateindex
|
||||
.as_ref()
|
||||
|
||||
@@ -43,8 +43,8 @@ impl Query {
|
||||
|
||||
// Get timestamps using difficultyepoch_to_timestamp for epoch start
|
||||
let epoch_start_timestamp = computer
|
||||
.chain
|
||||
.block
|
||||
.blocks
|
||||
.time
|
||||
.difficultyepoch_to_timestamp
|
||||
.read_once(current_epoch)?;
|
||||
let current_timestamp = indexer
|
||||
|
||||
@@ -22,9 +22,9 @@ pub fn iter_difficulty_epochs(
|
||||
.unwrap_or_default();
|
||||
|
||||
let mut epoch_to_height_iter = computer.indexes.block.difficultyepoch_to_first_height.iter();
|
||||
let mut epoch_to_timestamp_iter = computer.chain.block.difficultyepoch_to_timestamp.iter();
|
||||
let mut epoch_to_timestamp_iter = computer.blocks.time.difficultyepoch_to_timestamp.iter();
|
||||
let mut epoch_to_difficulty_iter = computer
|
||||
.chain
|
||||
.blocks
|
||||
.mining
|
||||
.indexes_to_difficulty
|
||||
.difficultyepoch
|
||||
|
||||
@@ -26,7 +26,7 @@ impl Query {
|
||||
.read_once(current_height)?;
|
||||
|
||||
let current_hashrate = *computer
|
||||
.chain
|
||||
.blocks
|
||||
.mining
|
||||
.indexes_to_hash_rate
|
||||
.dateindex
|
||||
@@ -57,7 +57,7 @@ impl Query {
|
||||
|
||||
// Create iterators for the loop
|
||||
let mut hashrate_iter = computer
|
||||
.chain
|
||||
.blocks
|
||||
.mining
|
||||
.indexes_to_hash_rate
|
||||
.dateindex
|
||||
@@ -65,8 +65,8 @@ impl Query {
|
||||
.iter();
|
||||
|
||||
let mut timestamp_iter = computer
|
||||
.chain
|
||||
.block
|
||||
.blocks
|
||||
.time
|
||||
.timeindexes_to_timestamp
|
||||
.dateindex
|
||||
.as_ref()
|
||||
|
||||
@@ -13,8 +13,8 @@ impl Query {
|
||||
let start_block = Height::from(current_height.to_usize().saturating_sub(block_count - 1));
|
||||
|
||||
let mut coinbase_iter = computer
|
||||
.chain
|
||||
.coinbase
|
||||
.blocks
|
||||
.rewards
|
||||
.indexes_to_coinbase
|
||||
.sats
|
||||
.height
|
||||
@@ -22,16 +22,16 @@ impl Query {
|
||||
.unwrap()
|
||||
.iter();
|
||||
let mut fee_iter = computer
|
||||
.chain
|
||||
.transaction
|
||||
.transactions
|
||||
.fees
|
||||
.indexes_to_fee
|
||||
.sats
|
||||
.height
|
||||
.unwrap_sum()
|
||||
.iter();
|
||||
let mut tx_count_iter = computer
|
||||
.chain
|
||||
.transaction
|
||||
.transactions
|
||||
.count
|
||||
.indexes_to_tx_count
|
||||
.height
|
||||
.as_ref()
|
||||
|
||||
@@ -121,7 +121,8 @@ impl Query {
|
||||
// Look up spend status
|
||||
let computer = self.computer();
|
||||
let txinindex = computer
|
||||
.txouts
|
||||
.outputs
|
||||
.spent
|
||||
.txoutindex_to_txinindex
|
||||
.read_once(txoutindex)?;
|
||||
|
||||
@@ -168,7 +169,7 @@ impl Query {
|
||||
|
||||
// Get spend status for each output
|
||||
let computer = self.computer();
|
||||
let mut txoutindex_to_txinindex_iter = computer.txouts.txoutindex_to_txinindex.iter()?;
|
||||
let mut txoutindex_to_txinindex_iter = computer.outputs.spent.txoutindex_to_txinindex.iter()?;
|
||||
|
||||
let mut outspends = Vec::with_capacity(output_count);
|
||||
for i in 0..output_count {
|
||||
@@ -203,7 +204,7 @@ impl Query {
|
||||
.tx
|
||||
.txindex_to_first_txinindex
|
||||
.read_once(txindex)?;
|
||||
let position = computer.blks.txindex_to_position.read_once(txindex)?;
|
||||
let position = computer.positions.txindex_to_position.read_once(txindex)?;
|
||||
|
||||
// Get block info for status
|
||||
let block_hash = indexer.vecs.block.height_to_blockhash.read_once(height)?;
|
||||
@@ -313,7 +314,7 @@ impl Query {
|
||||
let computer = self.computer();
|
||||
|
||||
let total_size = indexer.vecs.tx.txindex_to_total_size.read_once(txindex)?;
|
||||
let position = computer.blks.txindex_to_position.read_once(txindex)?;
|
||||
let position = computer.positions.txindex_to_position.read_once(txindex)?;
|
||||
|
||||
let buffer = reader.read_raw_bytes(position, *total_size as usize)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user