mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-25 07:09:59 -07:00
global: renames part 2
This commit is contained in:
@@ -27,7 +27,7 @@ impl Vecs {
|
||||
Ok(v.compute_count_from_indexes(
|
||||
starting_indexes.height,
|
||||
&indexer.vecs.scripts.p2ms.first_index,
|
||||
&indexer.vecs.scripts.p2ms.to_txindex,
|
||||
&indexer.vecs.scripts.p2ms.to_tx_index,
|
||||
exit,
|
||||
)?)
|
||||
})?;
|
||||
@@ -107,27 +107,27 @@ impl Vecs {
|
||||
Ok(v.compute_count_from_indexes(
|
||||
starting_indexes.height,
|
||||
&indexer.vecs.scripts.opreturn.first_index,
|
||||
&indexer.vecs.scripts.opreturn.to_txindex,
|
||||
&indexer.vecs.scripts.opreturn.to_tx_index,
|
||||
exit,
|
||||
)?)
|
||||
})?;
|
||||
|
||||
self.unknownoutput
|
||||
self.unknown_output
|
||||
.compute(starting_indexes.height, exit, |v| {
|
||||
Ok(v.compute_count_from_indexes(
|
||||
starting_indexes.height,
|
||||
&indexer.vecs.scripts.unknown.first_index,
|
||||
&indexer.vecs.scripts.unknown.to_txindex,
|
||||
&indexer.vecs.scripts.unknown.to_tx_index,
|
||||
exit,
|
||||
)?)
|
||||
})?;
|
||||
|
||||
self.emptyoutput
|
||||
self.empty_output
|
||||
.compute(starting_indexes.height, exit, |v| {
|
||||
Ok(v.compute_count_from_indexes(
|
||||
starting_indexes.height,
|
||||
&indexer.vecs.scripts.empty.first_index,
|
||||
&indexer.vecs.scripts.empty.to_txindex,
|
||||
&indexer.vecs.scripts.empty.to_tx_index,
|
||||
exit,
|
||||
)?)
|
||||
})?;
|
||||
|
||||
@@ -53,16 +53,16 @@ impl Vecs {
|
||||
indexes,
|
||||
cached_starts,
|
||||
)?,
|
||||
emptyoutput: PerBlockCumulativeWithSums::forced_import(
|
||||
empty_output: PerBlockCumulativeWithSums::forced_import(
|
||||
db,
|
||||
"emptyoutput_count",
|
||||
"empty_output_count",
|
||||
version,
|
||||
indexes,
|
||||
cached_starts,
|
||||
)?,
|
||||
unknownoutput: PerBlockCumulativeWithSums::forced_import(
|
||||
unknown_output: PerBlockCumulativeWithSums::forced_import(
|
||||
db,
|
||||
"unknownoutput_count",
|
||||
"unknown_output_count",
|
||||
version,
|
||||
indexes,
|
||||
cached_starts,
|
||||
|
||||
@@ -16,8 +16,8 @@ pub struct Vecs<M: StorageMode = Rw> {
|
||||
pub p2wpkh: PerBlockCumulativeWithSums<StoredU64, StoredU64, M>,
|
||||
pub p2wsh: PerBlockCumulativeWithSums<StoredU64, StoredU64, M>,
|
||||
pub opreturn: PerBlockCumulativeWithSums<StoredU64, StoredU64, M>,
|
||||
pub emptyoutput: PerBlockCumulativeWithSums<StoredU64, StoredU64, M>,
|
||||
pub unknownoutput: PerBlockCumulativeWithSums<StoredU64, StoredU64, M>,
|
||||
pub empty_output: PerBlockCumulativeWithSums<StoredU64, StoredU64, M>,
|
||||
pub unknown_output: PerBlockCumulativeWithSums<StoredU64, StoredU64, M>,
|
||||
|
||||
pub segwit: PerBlockCumulativeWithSums<StoredU64, StoredU64, M>,
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ impl Vecs {
|
||||
exit,
|
||||
|height_vec| {
|
||||
// Validate computed versions against dependencies
|
||||
let dep_version = indexer.vecs.outputs.first_txoutindex.version()
|
||||
+ indexer.vecs.outputs.outputtype.version()
|
||||
let dep_version = indexer.vecs.outputs.first_txout_index.version()
|
||||
+ indexer.vecs.outputs.output_type.version()
|
||||
+ indexer.vecs.outputs.value.version();
|
||||
height_vec.validate_computed_version_or_reset(dep_version)?;
|
||||
|
||||
// Get target height
|
||||
let target_len = indexer.vecs.outputs.first_txoutindex.len();
|
||||
let target_len = indexer.vecs.outputs.first_txout_index.len();
|
||||
if target_len == 0 {
|
||||
return Ok(());
|
||||
}
|
||||
@@ -42,14 +42,14 @@ impl Vecs {
|
||||
}
|
||||
|
||||
// Pre-collect height-indexed data
|
||||
let first_txoutindexes: Vec<TxOutIndex> =
|
||||
indexer.vecs.outputs.first_txoutindex.collect_range_at(
|
||||
let first_txout_indexes: Vec<TxOutIndex> =
|
||||
indexer.vecs.outputs.first_txout_index.collect_range_at(
|
||||
starting_height.to_usize(),
|
||||
target_height.to_usize()
|
||||
+ 2.min(indexer.vecs.outputs.first_txoutindex.len()),
|
||||
+ 2.min(indexer.vecs.outputs.first_txout_index.len()),
|
||||
);
|
||||
|
||||
let mut outputtypes_buf: Vec<OutputType> = Vec::new();
|
||||
let mut output_types_buf: Vec<OutputType> = Vec::new();
|
||||
let mut values_buf: Vec<Sats> = Vec::new();
|
||||
|
||||
// Iterate blocks
|
||||
@@ -58,23 +58,23 @@ impl Vecs {
|
||||
let local_idx = h - starting_height.to_usize();
|
||||
|
||||
// Get output range for this block
|
||||
let first_txoutindex = first_txoutindexes[local_idx];
|
||||
let next_first_txoutindex =
|
||||
if let Some(&next) = first_txoutindexes.get(local_idx + 1) {
|
||||
let first_txout_index = first_txout_indexes[local_idx];
|
||||
let next_first_txout_index =
|
||||
if let Some(&next) = first_txout_indexes.get(local_idx + 1) {
|
||||
next
|
||||
} else {
|
||||
TxOutIndex::from(indexer.vecs.outputs.value.len())
|
||||
};
|
||||
|
||||
let out_start = first_txoutindex.to_usize();
|
||||
let out_end = next_first_txoutindex.to_usize();
|
||||
let out_start = first_txout_index.to_usize();
|
||||
let out_end = next_first_txout_index.to_usize();
|
||||
|
||||
// Pre-collect both vecs into reusable buffers
|
||||
indexer
|
||||
.vecs
|
||||
.outputs
|
||||
.outputtype
|
||||
.collect_range_into_at(out_start, out_end, &mut outputtypes_buf);
|
||||
.output_type
|
||||
.collect_range_into_at(out_start, out_end, &mut output_types_buf);
|
||||
indexer
|
||||
.vecs
|
||||
.outputs
|
||||
@@ -82,7 +82,7 @@ impl Vecs {
|
||||
.collect_range_into_at(out_start, out_end, &mut values_buf);
|
||||
|
||||
let mut opreturn_value = Sats::ZERO;
|
||||
for (ot, val) in outputtypes_buf.iter().zip(values_buf.iter()) {
|
||||
for (ot, val) in output_types_buf.iter().zip(values_buf.iter()) {
|
||||
if *ot == OutputType::OpReturn {
|
||||
opreturn_value += *val;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user