global: snapshot

This commit is contained in:
nym21
2025-10-24 12:04:10 +02:00
parent 4f1653b086
commit 1e4acfe124
30 changed files with 200 additions and 139 deletions
+2 -2
View File
@@ -161,7 +161,7 @@ impl Vecs {
let txinindex_to_value = LazyVecFrom2::init(
"value",
version + Version::ZERO,
indexer.vecs.txinindex_to_txoutindex.boxed_clone(),
indexes.txinindex_to_txoutindex.boxed_clone(),
indexer.vecs.txoutindex_to_value.boxed_clone(),
|index: TxInIndex, txinindex_to_txoutindex_iter, txoutindex_to_value_iter| {
txinindex_to_txoutindex_iter.next_at(index.to_usize()).map(
@@ -224,7 +224,7 @@ impl Vecs {
let txindex_to_is_coinbase = LazyVecFrom2::init(
"is_coinbase",
version + Version::ZERO,
indexes.txindex_to_height.boxed_clone(),
indexer.vecs.txindex_to_height.boxed_clone(),
indexer.vecs.height_to_first_txindex.boxed_clone(),
|index: TxIndex, txindex_to_height_iter, height_to_first_txindex_iter| {
txindex_to_height_iter
-4
View File
@@ -233,10 +233,6 @@ impl Computer {
Ok(())
}
pub fn static_clone(&self) -> &'static Self {
Box::leak(Box::new(self.clone()))
}
}
// pub fn generate_allocation_files(monitored: &pools::Vecs) -> Result<()> {
+10 -6
View File
@@ -542,7 +542,8 @@ impl Vecs {
let height_to_first_p2wshaddressindex = &indexer.vecs.height_to_first_p2wshaddressindex;
let height_to_output_count = chain.indexes_to_output_count.height.unwrap_sum();
let height_to_input_count = chain.indexes_to_input_count.height.unwrap_sum();
let txinindex_to_txoutindex = &indexer.vecs.txinindex_to_txoutindex;
let txinindex_to_outpoint = &indexer.vecs.txinindex_to_outpoint;
let txindex_to_first_txoutindex = &indexer.vecs.txindex_to_first_txoutindex;
let txoutindex_to_value = &indexer.vecs.txoutindex_to_value;
let txindex_to_height = &indexer.vecs.txindex_to_height;
let height_to_timestamp_fixed = &indexes.height_to_timestamp_fixed;
@@ -582,9 +583,10 @@ impl Vecs {
+ height_to_timestamp_fixed.version()
+ height_to_output_count.version()
+ height_to_input_count.version()
+ txinindex_to_txoutindex.version()
+ txinindex_to_outpoint.version()
+ txoutindex_to_value.version()
+ txindex_to_height.version()
+ txindex_to_first_txoutindex.version()
+ txoutindex_to_txindex.version()
+ txoutindex_to_outputtype.version()
+ txoutindex_to_typeindex.version()
@@ -790,7 +792,8 @@ impl Vecs {
starting_indexes.update_from_height(starting_height, indexes);
let txinindex_to_txoutindex_reader = txinindex_to_txoutindex.create_reader();
let txinindex_to_outpoint_reader = txinindex_to_outpoint.create_reader();
let txindex_to_first_txoutindex_reader = txindex_to_first_txoutindex.create_reader();
let txoutindex_to_value_reader = txoutindex_to_value.create_reader();
let txoutindex_to_outputtype_reader = txoutindex_to_outputtype.create_reader();
let txoutindex_to_typeindex_reader = txoutindex_to_typeindex.create_reader();
@@ -1029,8 +1032,9 @@ impl Vecs {
.into_par_iter()
.map(TxInIndex::from)
.map(|txinindex| {
let txoutindex =
txinindex_to_txoutindex.unwrap_read(txinindex, &txinindex_to_txoutindex_reader);
let outpoint = txinindex_to_outpoint.unwrap_read(txinindex, &txinindex_to_outpoint_reader);
let txoutindex = txindex_to_first_txoutindex.unwrap_read(outpoint.txindex(), &txindex_to_first_txoutindex_reader) + outpoint.vout();
let value = txoutindex_to_value
.unwrap_read(txoutindex, &txoutindex_to_value_reader);
@@ -2005,7 +2009,7 @@ impl HeightToAddressTypeToVec<(TypeIndex, Sats)> {
let amount = prev_amount.checked_sub(value).unwrap();
let will_be_empty = addressdata.utxo_count - 1 == 0;
let will_be_empty = addressdata.has_1_utxos();
if will_be_empty
|| vecs.amount_range.get_mut(amount).0.clone()
@@ -44,14 +44,14 @@ impl AddressCohortState {
let prev_realized_price = compute_price.then(|| addressdata.realized_price());
let prev_supply_state = SupplyState {
utxo_count: addressdata.utxo_count as u64,
utxo_count: addressdata.utxo_count() as u64,
value: addressdata.balance(),
};
addressdata.send(value, prev_price)?;
let supply_state = SupplyState {
utxo_count: addressdata.utxo_count as u64,
utxo_count: addressdata.utxo_count() as u64,
value: addressdata.balance(),
};
@@ -82,14 +82,14 @@ impl AddressCohortState {
let prev_realized_price = compute_price.then(|| address_data.realized_price());
let prev_supply_state = SupplyState {
utxo_count: address_data.utxo_count as u64,
utxo_count: address_data.utxo_count() as u64,
value: address_data.balance(),
};
address_data.receive(value, price);
let supply_state = SupplyState {
utxo_count: address_data.utxo_count as u64,
utxo_count: address_data.utxo_count() as u64,
value: address_data.balance(),
};
+1 -1
View File
@@ -43,7 +43,7 @@ impl SubAssign<&SupplyState> for SupplyState {
impl From<&LoadedAddressData> for SupplyState {
fn from(value: &LoadedAddressData) -> Self {
Self {
utxo_count: value.utxo_count as u64,
utxo_count: value.utxo_count() as u64,
value: value.balance(),
}
}