mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-23 17:08:10 -07:00
global: fmt
This commit is contained in:
@@ -4,7 +4,10 @@ use brk_types::{StoredBool, TxIndex, Version};
|
||||
use vecdb::{Database, LazyVecFrom2, ReadableCloneableVec};
|
||||
|
||||
use super::Vecs;
|
||||
use crate::{indexes, internal::{CachedWindowStarts, PerBlockFull}};
|
||||
use crate::{
|
||||
indexes,
|
||||
internal::{CachedWindowStarts, PerBlockFull},
|
||||
};
|
||||
|
||||
impl Vecs {
|
||||
pub(crate) fn forced_import(
|
||||
@@ -27,13 +30,7 @@ impl Vecs {
|
||||
);
|
||||
|
||||
Ok(Self {
|
||||
total: PerBlockFull::forced_import(
|
||||
db,
|
||||
"tx_count",
|
||||
version,
|
||||
indexes,
|
||||
cached_starts,
|
||||
)?,
|
||||
total: PerBlockFull::forced_import(db, "tx_count", version, indexes, cached_starts)?,
|
||||
is_coinbase: tx_index_to_is_coinbase,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -36,8 +36,14 @@ impl Vecs {
|
||||
self.compute_fee_and_fee_rate(size_vecs, starting_indexes, exit)?;
|
||||
|
||||
let (r3, r4) = rayon::join(
|
||||
|| self.fee.derive_from_with_skip(indexer, indexes, starting_indexes, exit, 1),
|
||||
|| self.fee_rate.derive_from_with_skip(indexer, indexes, starting_indexes, exit, 1),
|
||||
|| {
|
||||
self.fee
|
||||
.derive_from_with_skip(indexer, indexes, starting_indexes, exit, 1)
|
||||
},
|
||||
|| {
|
||||
self.fee_rate
|
||||
.derive_from_with_skip(indexer, indexes, starting_indexes, exit, 1)
|
||||
},
|
||||
);
|
||||
r3?;
|
||||
r4?;
|
||||
@@ -78,8 +84,12 @@ impl Vecs {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
self.fee.tx_index.truncate_if_needed(starting_indexes.tx_index)?;
|
||||
self.fee_rate.tx_index.truncate_if_needed(starting_indexes.tx_index)?;
|
||||
self.fee
|
||||
.tx_index
|
||||
.truncate_if_needed(starting_indexes.tx_index)?;
|
||||
self.fee_rate
|
||||
.tx_index
|
||||
.truncate_if_needed(starting_indexes.tx_index)?;
|
||||
|
||||
loop {
|
||||
let skip = self.fee.tx_index.len();
|
||||
|
||||
@@ -9,7 +9,11 @@ use crate::{indexes, internal::PerTxDistribution};
|
||||
const VERSION: Version = Version::new(2);
|
||||
|
||||
impl Vecs {
|
||||
pub(crate) fn forced_import(db: &Database, version: Version, indexes: &indexes::Vecs) -> Result<Self> {
|
||||
pub(crate) fn forced_import(
|
||||
db: &Database,
|
||||
version: Version,
|
||||
indexes: &indexes::Vecs,
|
||||
) -> Result<Self> {
|
||||
let v = version + VERSION;
|
||||
Ok(Self {
|
||||
input_value: EagerVec::forced_import(db, "input_value", version)?,
|
||||
|
||||
@@ -6,7 +6,10 @@ use brk_types::Version;
|
||||
|
||||
use crate::{
|
||||
indexes,
|
||||
internal::{CachedWindowStarts, db_utils::{finalize_db, open_db}},
|
||||
internal::{
|
||||
CachedWindowStarts,
|
||||
db_utils::{finalize_db, open_db},
|
||||
},
|
||||
};
|
||||
|
||||
use super::{CountVecs, FeesVecs, SizeVecs, Vecs, VersionsVecs, VolumeVecs};
|
||||
|
||||
@@ -4,7 +4,10 @@ use brk_types::{TxIndex, VSize, Version, Weight};
|
||||
use vecdb::{Database, LazyVecFrom2, ReadableCloneableVec};
|
||||
|
||||
use super::Vecs;
|
||||
use crate::{indexes, internal::{LazyPerTxDistribution, LazyPerTxDistributionTransformed, VSizeToWeight}};
|
||||
use crate::{
|
||||
indexes,
|
||||
internal::{LazyPerTxDistribution, LazyPerTxDistributionTransformed, VSizeToWeight},
|
||||
};
|
||||
|
||||
impl Vecs {
|
||||
pub(crate) fn forced_import(
|
||||
@@ -23,8 +26,13 @@ impl Vecs {
|
||||
},
|
||||
);
|
||||
|
||||
let vsize =
|
||||
LazyPerTxDistribution::forced_import(db, "tx_vsize", version, indexes, tx_index_to_vsize)?;
|
||||
let vsize = LazyPerTxDistribution::forced_import(
|
||||
db,
|
||||
"tx_vsize",
|
||||
version,
|
||||
indexes,
|
||||
tx_index_to_vsize,
|
||||
)?;
|
||||
|
||||
let tx_index_to_weight = LazyVecFrom2::init(
|
||||
"tx_weight",
|
||||
|
||||
@@ -16,11 +16,7 @@ impl Vecs {
|
||||
+ indexer.vecs.transactions.first_tx_index.version()
|
||||
+ indexer.vecs.transactions.txid.version();
|
||||
|
||||
for vec in [
|
||||
&mut self.v1.block,
|
||||
&mut self.v2.block,
|
||||
&mut self.v3.block,
|
||||
] {
|
||||
for vec in [&mut self.v1.block, &mut self.v2.block, &mut self.v3.block] {
|
||||
vec.validate_and_truncate(dep_version, starting_indexes.height)?;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,27 @@ impl Vecs {
|
||||
cached_starts: &CachedWindowStarts,
|
||||
) -> Result<Self> {
|
||||
Ok(Self {
|
||||
v1: PerBlockCumulativeRolling::forced_import(db, "tx_v1", version, indexes, cached_starts)?,
|
||||
v2: PerBlockCumulativeRolling::forced_import(db, "tx_v2", version, indexes, cached_starts)?,
|
||||
v3: PerBlockCumulativeRolling::forced_import(db, "tx_v3", version, indexes, cached_starts)?,
|
||||
v1: PerBlockCumulativeRolling::forced_import(
|
||||
db,
|
||||
"tx_v1",
|
||||
version,
|
||||
indexes,
|
||||
cached_starts,
|
||||
)?,
|
||||
v2: PerBlockCumulativeRolling::forced_import(
|
||||
db,
|
||||
"tx_v2",
|
||||
version,
|
||||
indexes,
|
||||
cached_starts,
|
||||
)?,
|
||||
v3: PerBlockCumulativeRolling::forced_import(
|
||||
db,
|
||||
"tx_v3",
|
||||
version,
|
||||
indexes,
|
||||
cached_starts,
|
||||
)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user