mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-28 08:39:59 -07:00
global: rename outputindex and inputindex to txoutindex and txinindex
This commit is contained in:
@@ -5,7 +5,7 @@ use brk_error::Result;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_structs::{
|
||||
Bitcoin, CheckedSub, DateIndex, DecadeIndex, DifficultyEpoch, Dollars, FeeRate, HalvingEpoch,
|
||||
Height, InputIndex, MonthIndex, ONE_DAY_IN_SEC_F64, OutputIndex, QuarterIndex, Sats,
|
||||
Height, TxInIndex, MonthIndex, ONE_DAY_IN_SEC_F64, TxOutIndex, QuarterIndex, Sats,
|
||||
SemesterIndex, StoredBool, StoredF32, StoredF64, StoredU32, StoredU64, Timestamp, TxIndex,
|
||||
TxVersion, Version, WeekIndex, Weight, YearIndex,
|
||||
};
|
||||
@@ -73,12 +73,12 @@ pub struct Vecs {
|
||||
pub indexes_to_fee_rate: ComputedVecsFromTxindex<FeeRate>,
|
||||
/// Value == 0 when Coinbase
|
||||
pub txindex_to_input_value:
|
||||
LazyVecFrom3<TxIndex, Sats, TxIndex, InputIndex, TxIndex, StoredU64, InputIndex, Sats>,
|
||||
LazyVecFrom3<TxIndex, Sats, TxIndex, TxInIndex, TxIndex, StoredU64, TxInIndex, Sats>,
|
||||
pub indexes_to_sent: ComputedValueVecsFromHeight,
|
||||
// pub indexes_to_input_value: ComputedVecsFromTxindex<Sats>,
|
||||
pub indexes_to_opreturn_count: ComputedVecsFromHeight<StoredU64>,
|
||||
pub txindex_to_output_value:
|
||||
LazyVecFrom3<TxIndex, Sats, TxIndex, OutputIndex, TxIndex, StoredU64, OutputIndex, Sats>,
|
||||
LazyVecFrom3<TxIndex, Sats, TxIndex, TxOutIndex, TxIndex, StoredU64, TxOutIndex, Sats>,
|
||||
// pub indexes_to_output_value: ComputedVecsFromTxindex<Sats>,
|
||||
pub indexes_to_p2a_count: ComputedVecsFromHeight<StoredU64>,
|
||||
pub indexes_to_p2ms_count: ComputedVecsFromHeight<StoredU64>,
|
||||
@@ -98,8 +98,8 @@ pub struct Vecs {
|
||||
pub indexes_to_tx_vsize: ComputedVecsFromTxindex<StoredU64>,
|
||||
pub indexes_to_tx_weight: ComputedVecsFromTxindex<Weight>,
|
||||
pub indexes_to_unknownoutput_count: ComputedVecsFromHeight<StoredU64>,
|
||||
pub inputindex_to_value:
|
||||
LazyVecFrom2<InputIndex, Sats, InputIndex, OutputIndex, OutputIndex, Sats>,
|
||||
pub txinindex_to_value:
|
||||
LazyVecFrom2<TxInIndex, Sats, TxInIndex, TxOutIndex, TxOutIndex, Sats>,
|
||||
pub indexes_to_input_count: ComputedVecsFromTxindex<StoredU64>,
|
||||
pub txindex_to_is_coinbase: LazyVecFrom2<TxIndex, StoredBool, TxIndex, Height, Height, TxIndex>,
|
||||
pub indexes_to_output_count: ComputedVecsFromTxindex<StoredU64>,
|
||||
@@ -159,24 +159,24 @@ impl Vecs {
|
||||
|
||||
let compute_dollars = price.is_some();
|
||||
|
||||
let inputindex_to_value = LazyVecFrom2::init(
|
||||
let txinindex_to_value = LazyVecFrom2::init(
|
||||
"value",
|
||||
version + Version::ZERO,
|
||||
indexer.vecs.inputindex_to_outputindex.boxed_clone(),
|
||||
indexer.vecs.outputindex_to_value.boxed_clone(),
|
||||
|index: InputIndex, inputindex_to_outputindex_iter, outputindex_to_value_iter| {
|
||||
inputindex_to_outputindex_iter
|
||||
indexer.vecs.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.unwrap_to_usize())
|
||||
.map(|(inputindex, outputindex)| {
|
||||
let outputindex = outputindex.into_owned();
|
||||
if outputindex == OutputIndex::COINBASE {
|
||||
.map(|(txinindex, txoutindex)| {
|
||||
let txoutindex = txoutindex.into_owned();
|
||||
if txoutindex == TxOutIndex::COINBASE {
|
||||
Sats::ZERO
|
||||
} else if let Some((_, value)) =
|
||||
outputindex_to_value_iter.next_at(outputindex.unwrap_to_usize())
|
||||
txoutindex_to_value_iter.next_at(txoutindex.unwrap_to_usize())
|
||||
{
|
||||
value.into_owned()
|
||||
} else {
|
||||
dbg!(inputindex, outputindex);
|
||||
dbg!(txinindex, txoutindex);
|
||||
panic!()
|
||||
}
|
||||
})
|
||||
@@ -245,15 +245,15 @@ impl Vecs {
|
||||
let txindex_to_input_value = LazyVecFrom3::init(
|
||||
"input_value",
|
||||
version + Version::ZERO,
|
||||
indexer.vecs.txindex_to_first_inputindex.boxed_clone(),
|
||||
indexer.vecs.txindex_to_first_txinindex.boxed_clone(),
|
||||
indexes.txindex_to_input_count.boxed_clone(),
|
||||
inputindex_to_value.boxed_clone(),
|
||||
txinindex_to_value.boxed_clone(),
|
||||
|index: TxIndex,
|
||||
txindex_to_first_inputindex_iter,
|
||||
txindex_to_first_txinindex_iter,
|
||||
txindex_to_input_count_iter,
|
||||
inputindex_to_value_iter| {
|
||||
txinindex_to_value_iter| {
|
||||
let txindex = index.unwrap_to_usize();
|
||||
txindex_to_first_inputindex_iter
|
||||
txindex_to_first_txinindex_iter
|
||||
.next_at(txindex)
|
||||
.map(|(_, first_index)| {
|
||||
let first_index = usize::from(first_index.into_owned());
|
||||
@@ -263,10 +263,10 @@ impl Vecs {
|
||||
.1
|
||||
.into_owned();
|
||||
let range = first_index..first_index + count as usize;
|
||||
range.into_iter().fold(Sats::ZERO, |total, inputindex| {
|
||||
range.into_iter().fold(Sats::ZERO, |total, txinindex| {
|
||||
total
|
||||
+ inputindex_to_value_iter
|
||||
.next_at(inputindex)
|
||||
+ txinindex_to_value_iter
|
||||
.next_at(txinindex)
|
||||
.unwrap()
|
||||
.1
|
||||
.into_owned()
|
||||
@@ -292,15 +292,15 @@ impl Vecs {
|
||||
let txindex_to_output_value = LazyVecFrom3::init(
|
||||
"output_value",
|
||||
version + Version::ZERO,
|
||||
indexer.vecs.txindex_to_first_outputindex.boxed_clone(),
|
||||
indexer.vecs.txindex_to_first_txoutindex.boxed_clone(),
|
||||
indexes.txindex_to_output_count.boxed_clone(),
|
||||
indexer.vecs.outputindex_to_value.boxed_clone(),
|
||||
indexer.vecs.txoutindex_to_value.boxed_clone(),
|
||||
|index: TxIndex,
|
||||
txindex_to_first_outputindex_iter,
|
||||
txindex_to_first_txoutindex_iter,
|
||||
txindex_to_output_count_iter,
|
||||
outputindex_to_value_iter| {
|
||||
txoutindex_to_value_iter| {
|
||||
let txindex = index.unwrap_to_usize();
|
||||
txindex_to_first_outputindex_iter
|
||||
txindex_to_first_txoutindex_iter
|
||||
.next_at(txindex)
|
||||
.map(|(_, first_index)| {
|
||||
let first_index = usize::from(first_index.into_owned());
|
||||
@@ -310,9 +310,9 @@ impl Vecs {
|
||||
.1
|
||||
.into_owned();
|
||||
let range = first_index..first_index + count as usize;
|
||||
range.into_iter().fold(Sats::ZERO, |total, outputindex| {
|
||||
let v = outputindex_to_value_iter
|
||||
.next_at(outputindex)
|
||||
range.into_iter().fold(Sats::ZERO, |total, txoutindex| {
|
||||
let v = txoutindex_to_value_iter
|
||||
.next_at(txoutindex)
|
||||
.unwrap()
|
||||
.1
|
||||
.into_owned();
|
||||
@@ -1139,7 +1139,7 @@ impl Vecs {
|
||||
)?,
|
||||
|
||||
txindex_to_is_coinbase,
|
||||
inputindex_to_value,
|
||||
txinindex_to_value,
|
||||
// indexes_to_input_value,
|
||||
// indexes_to_output_value,
|
||||
txindex_to_input_value,
|
||||
@@ -1432,9 +1432,9 @@ impl Vecs {
|
||||
// |vec| {
|
||||
// vec.compute_sum_from_indexes(
|
||||
// starting_indexes.txindex,
|
||||
// &indexer.vecs.txindex_to_first_outputindex,
|
||||
// &indexer.vecs.txindex_to_first_txoutindex,
|
||||
// self.indexes_to_output_count.txindex.as_ref().unwrap(),
|
||||
// &indexer.vecs.outputindex_to_value,
|
||||
// &indexer.vecs.txoutindex_to_value,
|
||||
// exit,
|
||||
// )
|
||||
// },
|
||||
@@ -1448,9 +1448,9 @@ impl Vecs {
|
||||
// |vec| {
|
||||
// vec.compute_sum_from_indexes(
|
||||
// starting_indexes.txindex,
|
||||
// &indexer.vecs.txindex_to_first_inputindex,
|
||||
// &indexer.vecs.txindex_to_first_txinindex,
|
||||
// self.indexes_to_input_count.txindex.as_ref().unwrap(),
|
||||
// &self.inputindex_to_value,
|
||||
// &self.txinindex_to_value,
|
||||
// exit,
|
||||
// )
|
||||
// },
|
||||
@@ -1529,23 +1529,23 @@ impl Vecs {
|
||||
|
||||
self.indexes_to_coinbase
|
||||
.compute_all(indexes, price, starting_indexes, exit, |vec| {
|
||||
let mut txindex_to_first_outputindex_iter =
|
||||
indexer.vecs.txindex_to_first_outputindex.iter();
|
||||
let mut txindex_to_first_txoutindex_iter =
|
||||
indexer.vecs.txindex_to_first_txoutindex.iter();
|
||||
let mut txindex_to_output_count_iter = indexes.txindex_to_output_count.iter();
|
||||
let mut outputindex_to_value_iter = indexer.vecs.outputindex_to_value.iter();
|
||||
let mut txoutindex_to_value_iter = indexer.vecs.txoutindex_to_value.iter();
|
||||
vec.compute_transform(
|
||||
starting_indexes.height,
|
||||
&indexer.vecs.height_to_first_txindex,
|
||||
|(height, txindex, ..)| {
|
||||
let first_outputindex = txindex_to_first_outputindex_iter
|
||||
let first_txoutindex = txindex_to_first_txoutindex_iter
|
||||
.unwrap_get_inner(txindex)
|
||||
.unwrap_to_usize();
|
||||
let output_count = txindex_to_output_count_iter.unwrap_get_inner(txindex);
|
||||
let mut sats = Sats::ZERO;
|
||||
(first_outputindex..first_outputindex + usize::from(output_count))
|
||||
.for_each(|outputindex| {
|
||||
sats += outputindex_to_value_iter
|
||||
.unwrap_get_inner(OutputIndex::from(outputindex));
|
||||
(first_txoutindex..first_txoutindex + usize::from(output_count))
|
||||
.for_each(|txoutindex| {
|
||||
sats += txoutindex_to_value_iter
|
||||
.unwrap_get_inner(TxOutIndex::from(txoutindex));
|
||||
});
|
||||
(height, sats)
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ use brk_error::Result;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_structs::{
|
||||
Date, DateIndex, DecadeIndex, DifficultyEpoch, EmptyOutputIndex, HalvingEpoch, Height,
|
||||
InputIndex, MonthIndex, OpReturnIndex, OutputIndex, P2AAddressIndex, P2ABytes, P2MSOutputIndex,
|
||||
TxInIndex, MonthIndex, OpReturnIndex, TxOutIndex, P2AAddressIndex, P2ABytes, P2MSOutputIndex,
|
||||
P2PK33AddressIndex, P2PK33Bytes, P2PK65AddressIndex, P2PK65Bytes, P2PKHAddressIndex,
|
||||
P2PKHBytes, P2SHAddressIndex, P2SHBytes, P2TRAddressIndex, P2TRBytes, P2WPKHAddressIndex,
|
||||
P2WPKHBytes, P2WSHAddressIndex, P2WSHBytes, QuarterIndex, Sats, SemesterIndex, StoredU64,
|
||||
@@ -46,7 +46,7 @@ pub struct Vecs {
|
||||
pub height_to_height: EagerVec<Height, Height>,
|
||||
pub height_to_timestamp_fixed: EagerVec<Height, Timestamp>,
|
||||
pub height_to_txindex_count: EagerVec<Height, StoredU64>,
|
||||
pub inputindex_to_inputindex: LazyVecFrom1<InputIndex, InputIndex, InputIndex, OutputIndex>,
|
||||
pub txinindex_to_txinindex: LazyVecFrom1<TxInIndex, TxInIndex, TxInIndex, TxOutIndex>,
|
||||
pub monthindex_to_dateindex_count: EagerVec<MonthIndex, StoredU64>,
|
||||
pub monthindex_to_first_dateindex: EagerVec<MonthIndex, DateIndex>,
|
||||
pub monthindex_to_monthindex: EagerVec<MonthIndex, MonthIndex>,
|
||||
@@ -55,8 +55,8 @@ pub struct Vecs {
|
||||
pub monthindex_to_yearindex: EagerVec<MonthIndex, YearIndex>,
|
||||
pub opreturnindex_to_opreturnindex:
|
||||
LazyVecFrom1<OpReturnIndex, OpReturnIndex, OpReturnIndex, TxIndex>,
|
||||
pub outputindex_to_outputindex: LazyVecFrom1<OutputIndex, OutputIndex, OutputIndex, Sats>,
|
||||
pub outputindex_to_txindex: EagerVec<OutputIndex, TxIndex>,
|
||||
pub txoutindex_to_txoutindex: LazyVecFrom1<TxOutIndex, TxOutIndex, TxOutIndex, Sats>,
|
||||
pub txoutindex_to_txindex: EagerVec<TxOutIndex, TxIndex>,
|
||||
pub p2aaddressindex_to_p2aaddressindex:
|
||||
LazyVecFrom1<P2AAddressIndex, P2AAddressIndex, P2AAddressIndex, P2ABytes>,
|
||||
pub p2msoutputindex_to_p2msoutputindex:
|
||||
@@ -83,9 +83,9 @@ pub struct Vecs {
|
||||
pub semesterindex_to_semesterindex: EagerVec<SemesterIndex, SemesterIndex>,
|
||||
pub txindex_to_height: EagerVec<TxIndex, Height>,
|
||||
pub txindex_to_input_count:
|
||||
LazyVecFrom2<TxIndex, StoredU64, TxIndex, InputIndex, InputIndex, OutputIndex>,
|
||||
LazyVecFrom2<TxIndex, StoredU64, TxIndex, TxInIndex, TxInIndex, TxOutIndex>,
|
||||
pub txindex_to_output_count:
|
||||
LazyVecFrom2<TxIndex, StoredU64, TxIndex, OutputIndex, OutputIndex, Sats>,
|
||||
LazyVecFrom2<TxIndex, StoredU64, TxIndex, TxOutIndex, TxOutIndex, Sats>,
|
||||
pub txindex_to_txindex: LazyVecFrom1<TxIndex, TxIndex, TxIndex, Txid>,
|
||||
pub unknownoutputindex_to_unknownoutputindex:
|
||||
LazyVecFrom1<UnknownOutputIndex, UnknownOutputIndex, UnknownOutputIndex, TxIndex>,
|
||||
@@ -103,17 +103,17 @@ impl Vecs {
|
||||
let db = Database::open(&parent.join("indexes"))?;
|
||||
db.set_min_len(PAGE_SIZE * 10_000_000)?;
|
||||
|
||||
let outputindex_to_outputindex = LazyVecFrom1::init(
|
||||
"outputindex",
|
||||
let txoutindex_to_txoutindex = LazyVecFrom1::init(
|
||||
"txoutindex",
|
||||
version + VERSION + Version::ZERO,
|
||||
indexer.vecs.outputindex_to_value.boxed_clone(),
|
||||
indexer.vecs.txoutindex_to_value.boxed_clone(),
|
||||
|index, _| Some(index),
|
||||
);
|
||||
|
||||
let inputindex_to_inputindex = LazyVecFrom1::init(
|
||||
"inputindex",
|
||||
let txinindex_to_txinindex = LazyVecFrom1::init(
|
||||
"txinindex",
|
||||
version + VERSION + Version::ZERO,
|
||||
indexer.vecs.inputindex_to_outputindex.boxed_clone(),
|
||||
indexer.vecs.txinindex_to_txoutindex.boxed_clone(),
|
||||
|index, _| Some(index),
|
||||
);
|
||||
|
||||
@@ -127,18 +127,18 @@ impl Vecs {
|
||||
let txindex_to_input_count = LazyVecFrom2::init(
|
||||
"input_count",
|
||||
version + VERSION + Version::ZERO,
|
||||
indexer.vecs.txindex_to_first_inputindex.boxed_clone(),
|
||||
indexer.vecs.inputindex_to_outputindex.boxed_clone(),
|
||||
|index: TxIndex, txindex_to_first_inputindex_iter, inputindex_to_outputindex_iter| {
|
||||
indexer.vecs.txindex_to_first_txinindex.boxed_clone(),
|
||||
indexer.vecs.txinindex_to_txoutindex.boxed_clone(),
|
||||
|index: TxIndex, txindex_to_first_txinindex_iter, txinindex_to_txoutindex_iter| {
|
||||
let txindex = index.unwrap_to_usize();
|
||||
txindex_to_first_inputindex_iter
|
||||
txindex_to_first_txinindex_iter
|
||||
.next_at(txindex)
|
||||
.map(|(_, start)| {
|
||||
let start = usize::from(start.into_owned());
|
||||
let end = txindex_to_first_inputindex_iter
|
||||
let end = txindex_to_first_txinindex_iter
|
||||
.next_at(txindex + 1)
|
||||
.map(|(_, v)| usize::from(v.into_owned()))
|
||||
.unwrap_or_else(|| inputindex_to_outputindex_iter.len());
|
||||
.unwrap_or_else(|| txinindex_to_txoutindex_iter.len());
|
||||
StoredU64::from((start..end).count())
|
||||
})
|
||||
},
|
||||
@@ -147,18 +147,18 @@ impl Vecs {
|
||||
let txindex_to_output_count = LazyVecFrom2::init(
|
||||
"output_count",
|
||||
version + VERSION + Version::ZERO,
|
||||
indexer.vecs.txindex_to_first_outputindex.boxed_clone(),
|
||||
indexer.vecs.outputindex_to_value.boxed_clone(),
|
||||
|index: TxIndex, txindex_to_first_outputindex_iter, outputindex_to_value_iter| {
|
||||
indexer.vecs.txindex_to_first_txoutindex.boxed_clone(),
|
||||
indexer.vecs.txoutindex_to_value.boxed_clone(),
|
||||
|index: TxIndex, txindex_to_first_txoutindex_iter, txoutindex_to_value_iter| {
|
||||
let txindex = index.unwrap_to_usize();
|
||||
txindex_to_first_outputindex_iter
|
||||
txindex_to_first_txoutindex_iter
|
||||
.next_at(txindex)
|
||||
.map(|(_, start)| {
|
||||
let start = usize::from(start.into_owned());
|
||||
let end = txindex_to_first_outputindex_iter
|
||||
let end = txindex_to_first_txoutindex_iter
|
||||
.next_at(txindex + 1)
|
||||
.map(|(_, v)| usize::from(v.into_owned()))
|
||||
.unwrap_or_else(|| outputindex_to_value_iter.len());
|
||||
.unwrap_or_else(|| txoutindex_to_value_iter.len());
|
||||
StoredU64::from((start..end).count())
|
||||
})
|
||||
},
|
||||
@@ -239,9 +239,9 @@ impl Vecs {
|
||||
|
||||
let this = Self {
|
||||
emptyoutputindex_to_emptyoutputindex,
|
||||
inputindex_to_inputindex,
|
||||
txinindex_to_txinindex,
|
||||
opreturnindex_to_opreturnindex,
|
||||
outputindex_to_outputindex,
|
||||
txoutindex_to_txoutindex,
|
||||
p2aaddressindex_to_p2aaddressindex,
|
||||
p2msoutputindex_to_p2msoutputindex,
|
||||
p2pk33addressindex_to_p2pk33addressindex,
|
||||
@@ -466,7 +466,7 @@ impl Vecs {
|
||||
"yearindex_count",
|
||||
version + VERSION + Version::ZERO,
|
||||
)?,
|
||||
outputindex_to_txindex: EagerVec::forced_import_compressed(
|
||||
txoutindex_to_txindex: EagerVec::forced_import_compressed(
|
||||
&db,
|
||||
"txindex",
|
||||
version + VERSION + Version::ZERO,
|
||||
@@ -502,12 +502,12 @@ impl Vecs {
|
||||
exit: &Exit,
|
||||
) -> Result<Indexes> {
|
||||
// ---
|
||||
// OutputIndex
|
||||
// TxOutIndex
|
||||
// ---
|
||||
|
||||
self.outputindex_to_txindex.compute_inverse_less_to_more(
|
||||
self.txoutindex_to_txindex.compute_inverse_less_to_more(
|
||||
starting_indexes.txindex,
|
||||
&indexer.vecs.txindex_to_first_outputindex,
|
||||
&indexer.vecs.txindex_to_first_txoutindex,
|
||||
&self.txindex_to_output_count,
|
||||
exit,
|
||||
)?;
|
||||
|
||||
@@ -4,7 +4,7 @@ use allocative::Allocative;
|
||||
use brk_error::Result;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_store::AnyStore;
|
||||
use brk_structs::{Address, AddressBytes, Height, OutputIndex, OutputType, PoolId, Pools, pools};
|
||||
use brk_structs::{Address, AddressBytes, Height, TxOutIndex, OutputType, PoolId, Pools, pools};
|
||||
use brk_traversable::Traversable;
|
||||
use rayon::prelude::*;
|
||||
use vecdb::{
|
||||
@@ -122,11 +122,11 @@ impl Vecs {
|
||||
)?;
|
||||
|
||||
let mut height_to_first_txindex_iter = indexer.vecs.height_to_first_txindex.iter();
|
||||
let mut txindex_to_first_outputindex_iter =
|
||||
indexer.vecs.txindex_to_first_outputindex.iter();
|
||||
let mut txindex_to_first_txoutindex_iter =
|
||||
indexer.vecs.txindex_to_first_txoutindex.iter();
|
||||
let mut txindex_to_output_count_iter = indexes.txindex_to_output_count.iter();
|
||||
let mut outputindex_to_outputtype_iter = indexer.vecs.outputindex_to_outputtype.iter();
|
||||
let mut outputindex_to_typeindex_iter = indexer.vecs.outputindex_to_typeindex.iter();
|
||||
let mut txoutindex_to_outputtype_iter = indexer.vecs.txoutindex_to_outputtype.iter();
|
||||
let mut txoutindex_to_typeindex_iter = indexer.vecs.txoutindex_to_typeindex.iter();
|
||||
let mut p2pk65addressindex_to_p2pk65bytes_iter =
|
||||
indexer.vecs.p2pk65addressindex_to_p2pk65bytes.iter();
|
||||
let mut p2pk33addressindex_to_p2pk33bytes_iter =
|
||||
@@ -157,15 +157,15 @@ impl Vecs {
|
||||
.skip(min)
|
||||
.try_for_each(|(height, coinbase_tag)| -> Result<()> {
|
||||
let txindex = height_to_first_txindex_iter.unwrap_get_inner(height);
|
||||
let outputindex = txindex_to_first_outputindex_iter.unwrap_get_inner(txindex);
|
||||
let txoutindex = txindex_to_first_txoutindex_iter.unwrap_get_inner(txindex);
|
||||
let outputcount = txindex_to_output_count_iter.unwrap_get_inner(txindex);
|
||||
|
||||
let pool = (*outputindex..(*outputindex + *outputcount))
|
||||
.map(OutputIndex::from)
|
||||
.find_map(|outputindex| {
|
||||
let pool = (*txoutindex..(*txoutindex + *outputcount))
|
||||
.map(TxOutIndex::from)
|
||||
.find_map(|txoutindex| {
|
||||
let outputtype =
|
||||
outputindex_to_outputtype_iter.unwrap_get_inner(outputindex);
|
||||
let typeindex = outputindex_to_typeindex_iter.unwrap_get_inner(outputindex);
|
||||
txoutindex_to_outputtype_iter.unwrap_get_inner(txoutindex);
|
||||
let typeindex = txoutindex_to_typeindex_iter.unwrap_get_inner(txoutindex);
|
||||
|
||||
match outputtype {
|
||||
OutputType::P2PK65 => Some(AddressBytes::from(
|
||||
|
||||
@@ -11,7 +11,7 @@ use brk_grouper::{ByAddressType, ByAnyAddress, Filtered};
|
||||
use brk_indexer::Indexer;
|
||||
use brk_structs::{
|
||||
AnyAddressDataIndexEnum, AnyAddressIndex, CheckedSub, DateIndex, Dollars, EmptyAddressData,
|
||||
EmptyAddressIndex, Height, InputIndex, LoadedAddressData, LoadedAddressIndex, OutputIndex,
|
||||
EmptyAddressIndex, Height, TxInIndex, LoadedAddressData, LoadedAddressIndex, TxOutIndex,
|
||||
OutputType, P2AAddressIndex, P2PK33AddressIndex, P2PK65AddressIndex, P2PKHAddressIndex,
|
||||
P2SHAddressIndex, P2TRAddressIndex, P2WPKHAddressIndex, P2WSHAddressIndex, Sats, StoredU64,
|
||||
Timestamp, TypeIndex, Version,
|
||||
@@ -530,8 +530,8 @@ impl Vecs {
|
||||
starting_indexes: &mut Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
let height_to_first_outputindex = &indexer.vecs.height_to_first_outputindex;
|
||||
let height_to_first_inputindex = &indexer.vecs.height_to_first_inputindex;
|
||||
let height_to_first_txoutindex = &indexer.vecs.height_to_first_txoutindex;
|
||||
let height_to_first_txinindex = &indexer.vecs.height_to_first_txinindex;
|
||||
let height_to_first_p2aaddressindex = &indexer.vecs.height_to_first_p2aaddressindex;
|
||||
let height_to_first_p2pk33addressindex = &indexer.vecs.height_to_first_p2pk33addressindex;
|
||||
let height_to_first_p2pk65addressindex = &indexer.vecs.height_to_first_p2pk65addressindex;
|
||||
@@ -542,13 +542,13 @@ 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 inputindex_to_outputindex = &indexer.vecs.inputindex_to_outputindex;
|
||||
let outputindex_to_value = &indexer.vecs.outputindex_to_value;
|
||||
let txinindex_to_txoutindex = &indexer.vecs.txinindex_to_txoutindex;
|
||||
let txoutindex_to_value = &indexer.vecs.txoutindex_to_value;
|
||||
let txindex_to_height = &indexes.txindex_to_height;
|
||||
let height_to_timestamp_fixed = &indexes.height_to_timestamp_fixed;
|
||||
let outputindex_to_txindex = &indexes.outputindex_to_txindex;
|
||||
let outputindex_to_outputtype = &indexer.vecs.outputindex_to_outputtype;
|
||||
let outputindex_to_typeindex = &indexer.vecs.outputindex_to_typeindex;
|
||||
let txoutindex_to_txindex = &indexes.txoutindex_to_txindex;
|
||||
let txoutindex_to_outputtype = &indexer.vecs.txoutindex_to_outputtype;
|
||||
let txoutindex_to_typeindex = &indexer.vecs.txoutindex_to_typeindex;
|
||||
let height_to_unclaimed_rewards = chain
|
||||
.indexes_to_unclaimed_rewards
|
||||
.sats
|
||||
@@ -569,8 +569,8 @@ impl Vecs {
|
||||
let mut height_to_timestamp_fixed_iter = height_to_timestamp_fixed.into_iter();
|
||||
|
||||
let base_version = Version::ZERO
|
||||
+ height_to_first_outputindex.version()
|
||||
+ height_to_first_inputindex.version()
|
||||
+ height_to_first_txoutindex.version()
|
||||
+ height_to_first_txinindex.version()
|
||||
+ height_to_first_p2aaddressindex.version()
|
||||
+ height_to_first_p2pk33addressindex.version()
|
||||
+ height_to_first_p2pk65addressindex.version()
|
||||
@@ -582,12 +582,12 @@ impl Vecs {
|
||||
+ height_to_timestamp_fixed.version()
|
||||
+ height_to_output_count.version()
|
||||
+ height_to_input_count.version()
|
||||
+ inputindex_to_outputindex.version()
|
||||
+ outputindex_to_value.version()
|
||||
+ txinindex_to_txoutindex.version()
|
||||
+ txoutindex_to_value.version()
|
||||
+ txindex_to_height.version()
|
||||
+ outputindex_to_txindex.version()
|
||||
+ outputindex_to_outputtype.version()
|
||||
+ outputindex_to_typeindex.version()
|
||||
+ txoutindex_to_txindex.version()
|
||||
+ txoutindex_to_outputtype.version()
|
||||
+ txoutindex_to_typeindex.version()
|
||||
+ height_to_unclaimed_rewards.version()
|
||||
+ height_to_price_close
|
||||
.as_ref()
|
||||
@@ -790,13 +790,13 @@ impl Vecs {
|
||||
|
||||
starting_indexes.update_from_height(starting_height, indexes);
|
||||
|
||||
let inputindex_to_outputindex_reader = inputindex_to_outputindex.create_reader();
|
||||
let outputindex_to_value_reader = outputindex_to_value.create_reader();
|
||||
let outputindex_to_outputtype_reader = outputindex_to_outputtype.create_reader();
|
||||
let outputindex_to_typeindex_reader = outputindex_to_typeindex.create_reader();
|
||||
let txinindex_to_txoutindex_reader = txinindex_to_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();
|
||||
|
||||
let mut height_to_first_outputindex_iter = height_to_first_outputindex.into_iter();
|
||||
let mut height_to_first_inputindex_iter = height_to_first_inputindex.into_iter();
|
||||
let mut height_to_first_txoutindex_iter = height_to_first_txoutindex.into_iter();
|
||||
let mut height_to_first_txinindex_iter = height_to_first_txinindex.into_iter();
|
||||
let mut height_to_first_p2aaddressindex_iter =
|
||||
height_to_first_p2aaddressindex.into_iter();
|
||||
let mut height_to_first_p2pk33addressindex_iter =
|
||||
@@ -826,7 +826,7 @@ impl Vecs {
|
||||
height_to_price_close.map(|height_to_price_close| height_to_price_close.collect());
|
||||
|
||||
let height_to_timestamp_fixed_vec = height_to_timestamp_fixed.collect();
|
||||
let outputindex_range_to_height = RangeMap::from(height_to_first_outputindex);
|
||||
let txoutindex_range_to_height = RangeMap::from(height_to_first_txoutindex);
|
||||
|
||||
let mut unspendable_supply = if let Some(prev_height) = starting_height.decremented() {
|
||||
self.height_to_unspendable_supply
|
||||
@@ -893,10 +893,10 @@ impl Vecs {
|
||||
let price = height_to_price_close_iter
|
||||
.as_mut()
|
||||
.map(|i| *i.unwrap_get_inner(height));
|
||||
let first_outputindex = height_to_first_outputindex_iter
|
||||
let first_txoutindex = height_to_first_txoutindex_iter
|
||||
.unwrap_get_inner(height)
|
||||
.unwrap_to_usize();
|
||||
let first_inputindex = height_to_first_inputindex_iter
|
||||
let first_txinindex = height_to_first_txinindex_iter
|
||||
.unwrap_get_inner(height)
|
||||
.unwrap_to_usize();
|
||||
let output_count = height_to_output_count_iter.unwrap_get_inner(height);
|
||||
@@ -941,22 +941,22 @@ impl Vecs {
|
||||
.tick_tock_next_block(&chain_state, timestamp);
|
||||
});
|
||||
|
||||
let (transacted, addresstype_to_typedindex_to_received_data, receiving_addresstype_to_typeindex_to_addressdatawithsource) = (first_outputindex..first_outputindex + usize::from(output_count))
|
||||
let (transacted, addresstype_to_typedindex_to_received_data, receiving_addresstype_to_typeindex_to_addressdatawithsource) = (first_txoutindex..first_txoutindex + usize::from(output_count))
|
||||
.into_par_iter()
|
||||
.map(OutputIndex::from)
|
||||
.map(|outputindex| {
|
||||
let value = outputindex_to_value
|
||||
.unwrap_read(outputindex, &outputindex_to_value_reader);
|
||||
.map(TxOutIndex::from)
|
||||
.map(|txoutindex| {
|
||||
let value = txoutindex_to_value
|
||||
.unwrap_read(txoutindex, &txoutindex_to_value_reader);
|
||||
|
||||
let output_type = outputindex_to_outputtype
|
||||
.unwrap_read(outputindex, &outputindex_to_outputtype_reader);
|
||||
let output_type = txoutindex_to_outputtype
|
||||
.unwrap_read(txoutindex, &txoutindex_to_outputtype_reader);
|
||||
|
||||
if output_type.is_not_address() {
|
||||
return (value, output_type, None);
|
||||
}
|
||||
|
||||
let typeindex = outputindex_to_typeindex
|
||||
.unwrap_read(outputindex, &outputindex_to_typeindex_reader);
|
||||
let typeindex = txoutindex_to_typeindex
|
||||
.unwrap_read(txoutindex, &txoutindex_to_typeindex_reader);
|
||||
|
||||
let addressdata_opt = Self::get_addressdatawithsource(
|
||||
output_type,
|
||||
@@ -1025,28 +1025,28 @@ impl Vecs {
|
||||
);
|
||||
|
||||
// Skip coinbase
|
||||
let (height_to_sent, addresstype_to_typedindex_to_sent_data, sending_addresstype_to_typeindex_to_addressdatawithsource) = (first_inputindex + 1..first_inputindex + usize::from(input_count))
|
||||
let (height_to_sent, addresstype_to_typedindex_to_sent_data, sending_addresstype_to_typeindex_to_addressdatawithsource) = (first_txinindex + 1..first_txinindex + usize::from(input_count))
|
||||
.into_par_iter()
|
||||
.map(InputIndex::from)
|
||||
.map(|inputindex| {
|
||||
let outputindex =
|
||||
inputindex_to_outputindex.unwrap_read(inputindex, &inputindex_to_outputindex_reader);
|
||||
.map(TxInIndex::from)
|
||||
.map(|txinindex| {
|
||||
let txoutindex =
|
||||
txinindex_to_txoutindex.unwrap_read(txinindex, &txinindex_to_txoutindex_reader);
|
||||
|
||||
let value = outputindex_to_value
|
||||
.unwrap_read(outputindex, &outputindex_to_value_reader);
|
||||
let value = txoutindex_to_value
|
||||
.unwrap_read(txoutindex, &txoutindex_to_value_reader);
|
||||
|
||||
let input_type = outputindex_to_outputtype
|
||||
.unwrap_read(outputindex, &outputindex_to_outputtype_reader);
|
||||
let input_type = txoutindex_to_outputtype
|
||||
.unwrap_read(txoutindex, &txoutindex_to_outputtype_reader);
|
||||
|
||||
let prev_height =
|
||||
*outputindex_range_to_height.get(outputindex).unwrap();
|
||||
*txoutindex_range_to_height.get(txoutindex).unwrap();
|
||||
|
||||
if input_type.is_not_address() {
|
||||
return (prev_height, value, input_type, None);
|
||||
}
|
||||
|
||||
let typeindex = outputindex_to_typeindex
|
||||
.unwrap_read(outputindex, &outputindex_to_typeindex_reader);
|
||||
let typeindex = txoutindex_to_typeindex
|
||||
.unwrap_read(txoutindex, &txoutindex_to_typeindex_reader);
|
||||
|
||||
let addressdata_opt = Self::get_addressdatawithsource(
|
||||
input_type,
|
||||
|
||||
Reference in New Issue
Block a user