global: rename some indexes

This commit is contained in:
nym21
2025-06-23 22:00:09 +02:00
parent 589bb02411
commit 0f3c267a48
32 changed files with 1517 additions and 12239 deletions

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@
# Builds
target
dist
vecid-to-indexes.js
# Copies
*\ copy*

4
Cargo.lock generated
View File

@@ -653,9 +653,9 @@ dependencies = [
[[package]]
name = "brk_rmcp-macros"
version = "0.1.6"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12869ae1128aad2e0777db2688e661a55d389ecfb863936145ea1b789e0c2d34"
checksum = "e7e3a4b2b6bdb0508a756e9296321b6ce33234070060ad68f68c8372b7b53fc6"
dependencies = [
"proc-macro2",
"quote",

View File

@@ -15,10 +15,10 @@ const VERSION: Version = Version::ZERO;
#[derive(Clone)]
pub struct Vecs {
pub _0: ComputedVecsFromHeight<StoredU8>,
pub _1: ComputedVecsFromHeight<StoredU8>,
pub _50: ComputedVecsFromHeight<StoredU8>,
pub _100: ComputedVecsFromHeight<StoredU8>,
pub constant_0: ComputedVecsFromHeight<StoredU8>,
pub constant_1: ComputedVecsFromHeight<StoredU8>,
pub constant_50: ComputedVecsFromHeight<StoredU8>,
pub constant_100: ComputedVecsFromHeight<StoredU8>,
}
impl Vecs {
@@ -29,33 +29,33 @@ impl Vecs {
format: Format,
) -> color_eyre::Result<Self> {
Ok(Self {
_0: ComputedVecsFromHeight::forced_import(
constant_0: ComputedVecsFromHeight::forced_import(
path,
"0",
"constant_0",
true,
version + VERSION + Version::ZERO,
format,
StorableVecGeneatorOptions::default().add_last(),
)?,
_1: ComputedVecsFromHeight::forced_import(
constant_1: ComputedVecsFromHeight::forced_import(
path,
"1",
"constant_1",
true,
version + VERSION + Version::ZERO,
format,
StorableVecGeneatorOptions::default().add_last(),
)?,
_50: ComputedVecsFromHeight::forced_import(
constant_50: ComputedVecsFromHeight::forced_import(
path,
"50",
"constant_50",
true,
version + VERSION + Version::ZERO,
format,
StorableVecGeneatorOptions::default().add_last(),
)?,
_100: ComputedVecsFromHeight::forced_import(
constant_100: ComputedVecsFromHeight::forced_import(
path,
"100",
"constant_100",
true,
version + VERSION + Version::ZERO,
format,
@@ -71,7 +71,7 @@ impl Vecs {
starting_indexes: &Indexes,
exit: &Exit,
) -> color_eyre::Result<()> {
self._0.compute_all(
self.constant_0.compute_all(
indexer,
indexes,
starting_indexes,
@@ -87,7 +87,7 @@ impl Vecs {
},
)?;
self._1.compute_all(
self.constant_1.compute_all(
indexer,
indexes,
starting_indexes,
@@ -103,7 +103,7 @@ impl Vecs {
},
)?;
self._50.compute_all(
self.constant_50.compute_all(
indexer,
indexes,
starting_indexes,
@@ -119,7 +119,7 @@ impl Vecs {
},
)?;
self._100.compute_all(
self.constant_100.compute_all(
indexer,
indexes,
starting_indexes,
@@ -140,10 +140,10 @@ impl Vecs {
pub fn vecs(&self) -> Vec<&dyn AnyCollectableVec> {
[
self._0.vecs(),
self._1.vecs(),
self._50.vecs(),
self._100.vecs(),
self.constant_0.vecs(),
self.constant_1.vecs(),
self.constant_50.vecs(),
self.constant_100.vecs(),
]
.into_iter()
.flatten()

View File

@@ -2,10 +2,11 @@ use std::{ops::Deref, path::Path};
use brk_core::{
Date, DateIndex, DecadeIndex, DifficultyEpoch, EmptyOutputIndex, HalvingEpoch, Height,
InputIndex, MonthIndex, OpReturnIndex, OutputIndex, P2ABytes, P2AIndex, P2MSIndex, P2PK33Bytes,
P2PK33Index, P2PK65Bytes, P2PK65Index, P2PKHBytes, P2PKHIndex, P2SHBytes, P2SHIndex, P2TRBytes,
P2TRIndex, P2WPKHBytes, P2WPKHIndex, P2WSHBytes, P2WSHIndex, QuarterIndex, Sats, StoredUsize,
Timestamp, TxIndex, Txid, UnknownOutputIndex, Version, WeekIndex, YearIndex,
InputIndex, MonthIndex, OpReturnIndex, OutputIndex, P2AAddressIndex, P2ABytes, P2MSOutputIndex,
P2PK33AddressIndex, P2PK33Bytes, P2PK65AddressIndex, P2PK65Bytes, P2PKHAddressIndex,
P2PKHBytes, P2SHAddressIndex, P2SHBytes, P2TRAddressIndex, P2TRBytes, P2WPKHAddressIndex,
P2WPKHBytes, P2WSHAddressIndex, P2WSHBytes, QuarterIndex, Sats, StoredUsize, Timestamp,
TxIndex, Txid, UnknownOutputIndex, Version, WeekIndex, YearIndex,
};
use brk_exit::Exit;
use brk_indexer::Indexer;
@@ -54,18 +55,24 @@ pub struct Vecs {
ComputedVecFrom1<OpReturnIndex, OpReturnIndex, OpReturnIndex, TxIndex>,
pub outputindex_to_outputindex: ComputedVecFrom1<OutputIndex, OutputIndex, OutputIndex, Sats>,
pub outputindex_to_txindex: EagerVec<OutputIndex, TxIndex>,
pub p2aindex_to_p2aindex: ComputedVecFrom1<P2AIndex, P2AIndex, P2AIndex, P2ABytes>,
pub p2msindex_to_p2msindex: ComputedVecFrom1<P2MSIndex, P2MSIndex, P2MSIndex, TxIndex>,
pub p2pk33index_to_p2pk33index:
ComputedVecFrom1<P2PK33Index, P2PK33Index, P2PK33Index, P2PK33Bytes>,
pub p2pk65index_to_p2pk65index:
ComputedVecFrom1<P2PK65Index, P2PK65Index, P2PK65Index, P2PK65Bytes>,
pub p2pkhindex_to_p2pkhindex: ComputedVecFrom1<P2PKHIndex, P2PKHIndex, P2PKHIndex, P2PKHBytes>,
pub p2shindex_to_p2shindex: ComputedVecFrom1<P2SHIndex, P2SHIndex, P2SHIndex, P2SHBytes>,
pub p2trindex_to_p2trindex: ComputedVecFrom1<P2TRIndex, P2TRIndex, P2TRIndex, P2TRBytes>,
pub p2wpkhindex_to_p2wpkhindex:
ComputedVecFrom1<P2WPKHIndex, P2WPKHIndex, P2WPKHIndex, P2WPKHBytes>,
pub p2wshindex_to_p2wshindex: ComputedVecFrom1<P2WSHIndex, P2WSHIndex, P2WSHIndex, P2WSHBytes>,
pub p2aaddressindex_to_p2aaddressindex:
ComputedVecFrom1<P2AAddressIndex, P2AAddressIndex, P2AAddressIndex, P2ABytes>,
pub p2msoutputindex_to_p2msoutputindex:
ComputedVecFrom1<P2MSOutputIndex, P2MSOutputIndex, P2MSOutputIndex, TxIndex>,
pub p2pk33addressindex_to_p2pk33addressindex:
ComputedVecFrom1<P2PK33AddressIndex, P2PK33AddressIndex, P2PK33AddressIndex, P2PK33Bytes>,
pub p2pk65addressindex_to_p2pk65addressindex:
ComputedVecFrom1<P2PK65AddressIndex, P2PK65AddressIndex, P2PK65AddressIndex, P2PK65Bytes>,
pub p2pkhaddressindex_to_p2pkhaddressindex:
ComputedVecFrom1<P2PKHAddressIndex, P2PKHAddressIndex, P2PKHAddressIndex, P2PKHBytes>,
pub p2shaddressindex_to_p2shaddressindex:
ComputedVecFrom1<P2SHAddressIndex, P2SHAddressIndex, P2SHAddressIndex, P2SHBytes>,
pub p2traddressindex_to_p2traddressindex:
ComputedVecFrom1<P2TRAddressIndex, P2TRAddressIndex, P2TRAddressIndex, P2TRBytes>,
pub p2wpkhaddressindex_to_p2wpkhaddressindex:
ComputedVecFrom1<P2WPKHAddressIndex, P2WPKHAddressIndex, P2WPKHAddressIndex, P2WPKHBytes>,
pub p2wshaddressindex_to_p2wshaddressindex:
ComputedVecFrom1<P2WSHAddressIndex, P2WSHAddressIndex, P2WSHAddressIndex, P2WSHBytes>,
pub quarterindex_to_first_monthindex: EagerVec<QuarterIndex, MonthIndex>,
pub quarterindex_to_monthindex_count: EagerVec<QuarterIndex, StoredUsize>,
pub quarterindex_to_quarterindex: EagerVec<QuarterIndex, QuarterIndex>,
@@ -170,85 +177,85 @@ impl Vecs {
},
)?;
let p2pk33index_to_p2pk33index = ComputedVec::forced_import_or_init_from_1(
let p2pk33addressindex_to_p2pk33addressindex = ComputedVec::forced_import_or_init_from_1(
computation,
path,
"p2pk33index",
"p2pk33addressindex",
version + VERSION + Version::ZERO,
format,
indexer.vecs.p2pk33index_to_p2pk33bytes.boxed_clone(),
indexer.vecs.p2pk33addressindex_to_p2pk33bytes.boxed_clone(),
|index, _| Some(index),
)?;
let p2pk65index_to_p2pk65index = ComputedVec::forced_import_or_init_from_1(
let p2pk65addressindex_to_p2pk65addressindex = ComputedVec::forced_import_or_init_from_1(
computation,
path,
"p2pk65index",
"p2pk65addressindex",
version + VERSION + Version::ZERO,
format,
indexer.vecs.p2pk65index_to_p2pk65bytes.boxed_clone(),
indexer.vecs.p2pk65addressindex_to_p2pk65bytes.boxed_clone(),
|index, _| Some(index),
)?;
let p2pkhindex_to_p2pkhindex = ComputedVec::forced_import_or_init_from_1(
let p2pkhaddressindex_to_p2pkhaddressindex = ComputedVec::forced_import_or_init_from_1(
computation,
path,
"p2pkhindex",
"p2pkhaddressindex",
version + VERSION + Version::ZERO,
format,
indexer.vecs.p2pkhindex_to_p2pkhbytes.boxed_clone(),
indexer.vecs.p2pkhaddressindex_to_p2pkhbytes.boxed_clone(),
|index, _| Some(index),
)?;
let p2shindex_to_p2shindex = ComputedVec::forced_import_or_init_from_1(
let p2shaddressindex_to_p2shaddressindex = ComputedVec::forced_import_or_init_from_1(
computation,
path,
"p2shindex",
"p2shaddressindex",
version + VERSION + Version::ZERO,
format,
indexer.vecs.p2shindex_to_p2shbytes.boxed_clone(),
indexer.vecs.p2shaddressindex_to_p2shbytes.boxed_clone(),
|index, _| Some(index),
)?;
let p2trindex_to_p2trindex = ComputedVec::forced_import_or_init_from_1(
let p2traddressindex_to_p2traddressindex = ComputedVec::forced_import_or_init_from_1(
computation,
path,
"p2trindex",
"p2traddressindex",
version + VERSION + Version::ZERO,
format,
indexer.vecs.p2trindex_to_p2trbytes.boxed_clone(),
indexer.vecs.p2traddressindex_to_p2trbytes.boxed_clone(),
|index, _| Some(index),
)?;
let p2wpkhindex_to_p2wpkhindex = ComputedVec::forced_import_or_init_from_1(
let p2wpkhaddressindex_to_p2wpkhaddressindex = ComputedVec::forced_import_or_init_from_1(
computation,
path,
"p2wpkhindex",
"p2wpkhaddressindex",
version + VERSION + Version::ZERO,
format,
indexer.vecs.p2wpkhindex_to_p2wpkhbytes.boxed_clone(),
indexer.vecs.p2wpkhaddressindex_to_p2wpkhbytes.boxed_clone(),
|index, _| Some(index),
)?;
let p2wshindex_to_p2wshindex = ComputedVec::forced_import_or_init_from_1(
let p2wshaddressindex_to_p2wshaddressindex = ComputedVec::forced_import_or_init_from_1(
computation,
path,
"p2wshindex",
"p2wshaddressindex",
version + VERSION + Version::ZERO,
format,
indexer.vecs.p2wshindex_to_p2wshbytes.boxed_clone(),
indexer.vecs.p2wshaddressindex_to_p2wshbytes.boxed_clone(),
|index, _| Some(index),
)?;
let p2aindex_to_p2aindex = ComputedVec::forced_import_or_init_from_1(
let p2aaddressindex_to_p2aaddressindex = ComputedVec::forced_import_or_init_from_1(
computation,
path,
"p2aindex",
"p2aaddressindex",
version + VERSION + Version::ZERO,
format,
indexer.vecs.p2aindex_to_p2abytes.boxed_clone(),
indexer.vecs.p2aaddressindex_to_p2abytes.boxed_clone(),
|index, _| Some(index),
)?;
let p2msindex_to_p2msindex = ComputedVec::forced_import_or_init_from_1(
let p2msoutputindex_to_p2msoutputindex = ComputedVec::forced_import_or_init_from_1(
computation,
path,
"p2msindex",
"p2msoutputindex",
version + VERSION + Version::ZERO,
format,
indexer.vecs.p2msindex_to_txindex.boxed_clone(),
indexer.vecs.p2msoutputindex_to_txindex.boxed_clone(),
|index, _| Some(index),
)?;
let emptyoutputindex_to_emptyoutputindex = ComputedVec::forced_import_or_init_from_1(
@@ -284,15 +291,15 @@ impl Vecs {
inputindex_to_inputindex,
opreturnindex_to_opreturnindex,
outputindex_to_outputindex,
p2aindex_to_p2aindex,
p2msindex_to_p2msindex,
p2pk33index_to_p2pk33index,
p2pk65index_to_p2pk65index,
p2pkhindex_to_p2pkhindex,
p2shindex_to_p2shindex,
p2trindex_to_p2trindex,
p2wpkhindex_to_p2wpkhindex,
p2wshindex_to_p2wshindex,
p2aaddressindex_to_p2aaddressindex,
p2msoutputindex_to_p2msoutputindex,
p2pk33addressindex_to_p2pk33addressindex,
p2pk65addressindex_to_p2pk65addressindex,
p2pkhaddressindex_to_p2pkhaddressindex,
p2shaddressindex_to_p2shaddressindex,
p2traddressindex_to_p2traddressindex,
p2wpkhaddressindex_to_p2wpkhaddressindex,
p2wshaddressindex_to_p2wshaddressindex,
txindex_to_input_count,
txindex_to_output_count,
txindex_to_txindex,
@@ -570,47 +577,54 @@ impl Vecs {
exit,
)?;
self.p2pk33index_to_p2pk33index.compute_if_necessary(
starting_indexes.p2pk33index,
&indexer.vecs.p2pk33index_to_p2pk33bytes,
exit,
)?;
self.p2pk33addressindex_to_p2pk33addressindex
.compute_if_necessary(
starting_indexes.p2pk33addressindex,
&indexer.vecs.p2pk33addressindex_to_p2pk33bytes,
exit,
)?;
self.p2pk65index_to_p2pk65index.compute_if_necessary(
starting_indexes.p2pk65index,
&indexer.vecs.p2pk65index_to_p2pk65bytes,
exit,
)?;
self.p2pk65addressindex_to_p2pk65addressindex
.compute_if_necessary(
starting_indexes.p2pk65addressindex,
&indexer.vecs.p2pk65addressindex_to_p2pk65bytes,
exit,
)?;
self.p2pkhindex_to_p2pkhindex.compute_if_necessary(
starting_indexes.p2pkhindex,
&indexer.vecs.p2pkhindex_to_p2pkhbytes,
exit,
)?;
self.p2pkhaddressindex_to_p2pkhaddressindex
.compute_if_necessary(
starting_indexes.p2pkhaddressindex,
&indexer.vecs.p2pkhaddressindex_to_p2pkhbytes,
exit,
)?;
self.p2shindex_to_p2shindex.compute_if_necessary(
starting_indexes.p2shindex,
&indexer.vecs.p2shindex_to_p2shbytes,
exit,
)?;
self.p2shaddressindex_to_p2shaddressindex
.compute_if_necessary(
starting_indexes.p2shaddressindex,
&indexer.vecs.p2shaddressindex_to_p2shbytes,
exit,
)?;
self.p2trindex_to_p2trindex.compute_if_necessary(
starting_indexes.p2trindex,
&indexer.vecs.p2trindex_to_p2trbytes,
exit,
)?;
self.p2traddressindex_to_p2traddressindex
.compute_if_necessary(
starting_indexes.p2traddressindex,
&indexer.vecs.p2traddressindex_to_p2trbytes,
exit,
)?;
self.p2wpkhindex_to_p2wpkhindex.compute_if_necessary(
starting_indexes.p2wpkhindex,
&indexer.vecs.p2wpkhindex_to_p2wpkhbytes,
exit,
)?;
self.p2wpkhaddressindex_to_p2wpkhaddressindex
.compute_if_necessary(
starting_indexes.p2wpkhaddressindex,
&indexer.vecs.p2wpkhaddressindex_to_p2wpkhbytes,
exit,
)?;
self.p2wshindex_to_p2wshindex.compute_if_necessary(
starting_indexes.p2wshindex,
&indexer.vecs.p2wshindex_to_p2wshbytes,
exit,
)?;
self.p2wshaddressindex_to_p2wshaddressindex
.compute_if_necessary(
starting_indexes.p2wshaddressindex,
&indexer.vecs.p2wshaddressindex_to_p2wshbytes,
exit,
)?;
self.emptyoutputindex_to_emptyoutputindex
.compute_if_necessary(
@@ -619,11 +633,12 @@ impl Vecs {
exit,
)?;
self.p2msindex_to_p2msindex.compute_if_necessary(
starting_indexes.p2msindex,
&indexer.vecs.p2msindex_to_txindex,
exit,
)?;
self.p2msoutputindex_to_p2msoutputindex
.compute_if_necessary(
starting_indexes.p2msoutputindex,
&indexer.vecs.p2msoutputindex_to_txindex,
exit,
)?;
self.opreturnindex_to_opreturnindex.compute_if_necessary(
starting_indexes.opreturnindex,
@@ -631,11 +646,12 @@ impl Vecs {
exit,
)?;
self.p2aindex_to_p2aindex.compute_if_necessary(
starting_indexes.p2aindex,
&indexer.vecs.p2aindex_to_p2abytes,
exit,
)?;
self.p2aaddressindex_to_p2aaddressindex
.compute_if_necessary(
starting_indexes.p2aaddressindex,
&indexer.vecs.p2aaddressindex_to_p2abytes,
exit,
)?;
self.unknownoutputindex_to_unknownoutputindex
.compute_if_necessary(
@@ -1075,15 +1091,15 @@ impl Vecs {
&self.monthindex_to_yearindex,
&self.opreturnindex_to_opreturnindex,
&self.outputindex_to_outputindex,
&self.p2aindex_to_p2aindex,
&self.p2msindex_to_p2msindex,
&self.p2pk33index_to_p2pk33index,
&self.p2pk65index_to_p2pk65index,
&self.p2pkhindex_to_p2pkhindex,
&self.p2shindex_to_p2shindex,
&self.p2trindex_to_p2trindex,
&self.p2wpkhindex_to_p2wpkhindex,
&self.p2wshindex_to_p2wshindex,
&self.p2aaddressindex_to_p2aaddressindex,
&self.p2msoutputindex_to_p2msoutputindex,
&self.p2pk33addressindex_to_p2pk33addressindex,
&self.p2pk65addressindex_to_p2pk65addressindex,
&self.p2pkhaddressindex_to_p2pkhaddressindex,
&self.p2shaddressindex_to_p2shaddressindex,
&self.p2traddressindex_to_p2traddressindex,
&self.p2wpkhaddressindex_to_p2wpkhaddressindex,
&self.p2wshaddressindex_to_p2wshaddressindex,
&self.quarterindex_to_first_monthindex,
&self.quarterindex_to_monthindex_count,
&self.quarterindex_to_quarterindex,

View File

@@ -931,8 +931,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes(
starting_indexes.height,
&indexer.vecs.height_to_first_p2aindex,
&indexer.vecs.p2aindex_to_p2abytes,
&indexer.vecs.height_to_first_p2aaddressindex,
&indexer.vecs.p2aaddressindex_to_p2abytes,
exit,
)
},
@@ -946,8 +946,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes(
starting_indexes.height,
&indexer.vecs.height_to_first_p2msindex,
&indexer.vecs.p2msindex_to_txindex,
&indexer.vecs.height_to_first_p2msoutputindex,
&indexer.vecs.p2msoutputindex_to_txindex,
exit,
)
},
@@ -961,8 +961,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes(
starting_indexes.height,
&indexer.vecs.height_to_first_p2pk33index,
&indexer.vecs.p2pk33index_to_p2pk33bytes,
&indexer.vecs.height_to_first_p2pk33addressindex,
&indexer.vecs.p2pk33addressindex_to_p2pk33bytes,
exit,
)
},
@@ -976,8 +976,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes(
starting_indexes.height,
&indexer.vecs.height_to_first_p2pk65index,
&indexer.vecs.p2pk65index_to_p2pk65bytes,
&indexer.vecs.height_to_first_p2pk65addressindex,
&indexer.vecs.p2pk65addressindex_to_p2pk65bytes,
exit,
)
},
@@ -991,8 +991,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes(
starting_indexes.height,
&indexer.vecs.height_to_first_p2pkhindex,
&indexer.vecs.p2pkhindex_to_p2pkhbytes,
&indexer.vecs.height_to_first_p2pkhaddressindex,
&indexer.vecs.p2pkhaddressindex_to_p2pkhbytes,
exit,
)
},
@@ -1006,8 +1006,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes(
starting_indexes.height,
&indexer.vecs.height_to_first_p2shindex,
&indexer.vecs.p2shindex_to_p2shbytes,
&indexer.vecs.height_to_first_p2shaddressindex,
&indexer.vecs.p2shaddressindex_to_p2shbytes,
exit,
)
},
@@ -1021,8 +1021,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes(
starting_indexes.height,
&indexer.vecs.height_to_first_p2trindex,
&indexer.vecs.p2trindex_to_p2trbytes,
&indexer.vecs.height_to_first_p2traddressindex,
&indexer.vecs.p2traddressindex_to_p2trbytes,
exit,
)
},
@@ -1036,8 +1036,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes(
starting_indexes.height,
&indexer.vecs.height_to_first_p2wpkhindex,
&indexer.vecs.p2wpkhindex_to_p2wpkhbytes,
&indexer.vecs.height_to_first_p2wpkhaddressindex,
&indexer.vecs.p2wpkhaddressindex_to_p2wpkhbytes,
exit,
)
},
@@ -1051,8 +1051,8 @@ impl Vecs {
|v, indexer, _, starting_indexes, exit| {
v.compute_count_from_indexes(
starting_indexes.height,
&indexer.vecs.height_to_first_p2wshindex,
&indexer.vecs.p2wshindex_to_p2wshbytes,
&indexer.vecs.height_to_first_p2wshaddressindex,
&indexer.vecs.p2wshaddressindex_to_p2wshbytes,
exit,
)
},

View File

@@ -0,0 +1,61 @@
use std::ops::Add;
use derive_deref::{Deref, DerefMut};
use serde::Serialize;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable, TypeIndex};
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct EmptyOutputIndex(TypeIndex);
impl From<TypeIndex> for EmptyOutputIndex {
fn from(value: TypeIndex) -> Self {
Self(value)
}
}
impl From<EmptyOutputIndex> for usize {
fn from(value: EmptyOutputIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for EmptyOutputIndex {
fn from(value: usize) -> Self {
Self(TypeIndex::from(value))
}
}
impl Add<usize> for EmptyOutputIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<EmptyOutputIndex> for EmptyOutputIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}
impl Printable for EmptyOutputIndex {
fn to_string() -> &'static str {
"emptyoutputindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["emptyout", "emptyoutputindex"]
}
}

View File

@@ -1,8 +1,5 @@
mod addressbytes;
mod addressbyteshash;
// mod addressindex;
// mod addressindexoutputindex;
// mod addresstype;
mod bitcoin;
mod blockhash;
mod blockhashprefix;
@@ -12,15 +9,25 @@ mod dateindex;
mod decadeindex;
mod difficultyepoch;
mod dollars;
mod emptyoutputindex;
mod feerate;
mod halvingepoch;
mod height;
mod inputindex;
mod monthindex;
mod ohlc;
mod opreturnindex;
mod outputindex;
mod outputtype;
mod outputtypeindex;
mod p2aaddressindex;
mod p2msoutputindex;
mod p2pk33addressindex;
mod p2pk65addressindex;
mod p2pkhaddressindex;
mod p2shaddressindex;
mod p2traddressindex;
mod p2wpkhaddressindex;
mod p2wshaddressindex;
mod quarterindex;
mod rawlocktime;
mod sats;
@@ -35,7 +42,9 @@ mod txid;
mod txidprefix;
mod txindex;
mod txversion;
mod typeindex;
mod unit;
mod unknownoutputindex;
mod version;
mod vin;
mod vout;
@@ -45,9 +54,6 @@ mod yearindex;
pub use addressbytes::*;
pub use addressbyteshash::*;
// pub use addressindex::*;
// pub use addressindexoutputindex::*;
// pub use addresstype::*;
pub use bitcoin::*;
pub use blockhash::*;
pub use blockhashprefix::*;
@@ -55,17 +61,28 @@ pub use cents::*;
pub use date::*;
pub use dateindex::*;
pub use decadeindex::*;
pub use decadeindex::*;
pub use difficultyepoch::*;
pub use dollars::*;
pub use emptyoutputindex::*;
pub use feerate::*;
pub use halvingepoch::*;
pub use height::*;
pub use inputindex::*;
pub use monthindex::*;
pub use ohlc::*;
pub use opreturnindex::*;
pub use outputindex::*;
pub use outputtype::*;
pub use outputtypeindex::*;
pub use p2aaddressindex::*;
pub use p2msoutputindex::*;
pub use p2pk33addressindex::*;
pub use p2pk65addressindex::*;
pub use p2pkhaddressindex::*;
pub use p2shaddressindex::*;
pub use p2traddressindex::*;
pub use p2wpkhaddressindex::*;
pub use p2wshaddressindex::*;
pub use quarterindex::*;
pub use rawlocktime::*;
pub use sats::*;
@@ -80,7 +97,9 @@ pub use txid::*;
pub use txidprefix::*;
pub use txindex::*;
pub use txversion::*;
pub use typeindex::*;
pub use unit::*;
pub use unknownoutputindex::*;
pub use version::*;
pub use vin::*;
pub use vout::*;

View File

@@ -0,0 +1,62 @@
use std::ops::Add;
use derive_deref::{Deref, DerefMut};
use serde::Serialize;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable, TypeIndex};
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct OpReturnIndex(TypeIndex);
impl From<TypeIndex> for OpReturnIndex {
fn from(value: TypeIndex) -> Self {
Self(value)
}
}
impl From<OpReturnIndex> for usize {
fn from(value: OpReturnIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for OpReturnIndex {
fn from(value: usize) -> Self {
Self(TypeIndex::from(value))
}
}
impl Add<usize> for OpReturnIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<OpReturnIndex> for OpReturnIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}
impl Printable for OpReturnIndex {
fn to_string() -> &'static str {
"opreturnindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["op", "opreturn", "opreturnindex"]
}
}

View File

@@ -1,752 +0,0 @@
use std::ops::Add;
use byteview::ByteView;
use derive_deref::{Deref, DerefMut};
use serde::Serialize;
use zerocopy::{FromBytes, IntoBytes};
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable};
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct OutputTypeIndex(u32);
impl OutputTypeIndex {
pub fn increment(&mut self) {
self.0 += 1;
}
pub fn incremented(self) -> Self {
Self(self.0 + 1)
}
pub fn copy_then_increment(&mut self) -> Self {
let i = *self;
self.increment();
i
}
}
impl From<u32> for OutputTypeIndex {
fn from(value: u32) -> Self {
Self(value)
}
}
impl From<u64> for OutputTypeIndex {
fn from(value: u64) -> Self {
Self(value as u32)
}
}
impl From<OutputTypeIndex> for u64 {
fn from(value: OutputTypeIndex) -> Self {
value.0 as u64
}
}
impl From<usize> for OutputTypeIndex {
fn from(value: usize) -> Self {
Self(value as u32)
}
}
impl From<OutputTypeIndex> for usize {
fn from(value: OutputTypeIndex) -> Self {
value.0 as usize
}
}
impl Add<usize> for OutputTypeIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(self.0 + rhs as u32)
}
}
impl Add<OutputTypeIndex> for OutputTypeIndex {
type Output = Self;
fn add(self, rhs: OutputTypeIndex) -> Self::Output {
Self(self.0 + rhs.0)
}
}
impl From<ByteView> for OutputTypeIndex {
fn from(value: ByteView) -> Self {
Self::read_from_bytes(&value).unwrap()
}
}
impl From<OutputTypeIndex> for ByteView {
fn from(value: OutputTypeIndex) -> Self {
Self::new(value.as_bytes())
}
}
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct EmptyOutputIndex(OutputTypeIndex);
impl From<OutputTypeIndex> for EmptyOutputIndex {
fn from(value: OutputTypeIndex) -> Self {
Self(value)
}
}
impl From<EmptyOutputIndex> for usize {
fn from(value: EmptyOutputIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for EmptyOutputIndex {
fn from(value: usize) -> Self {
Self(OutputTypeIndex::from(value))
}
}
impl Add<usize> for EmptyOutputIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<EmptyOutputIndex> for EmptyOutputIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.0.checked_sub(rhs.0.0).map(OutputTypeIndex).map(Self)
}
}
impl Printable for EmptyOutputIndex {
fn to_string() -> &'static str {
"emptyoutputindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["empty", "emptyoutputindex"]
}
}
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2MSIndex(OutputTypeIndex);
impl From<OutputTypeIndex> for P2MSIndex {
fn from(value: OutputTypeIndex) -> Self {
Self(value)
}
}
impl From<P2MSIndex> for usize {
fn from(value: P2MSIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2MSIndex {
fn from(value: usize) -> Self {
Self(OutputTypeIndex::from(value))
}
}
impl Add<usize> for P2MSIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2MSIndex> for P2MSIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.0.checked_sub(rhs.0.0).map(OutputTypeIndex).map(Self)
}
}
impl Printable for P2MSIndex {
fn to_string() -> &'static str {
"p2msindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["ms", "p2ms", "p2msindex"]
}
}
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2AIndex(OutputTypeIndex);
impl From<OutputTypeIndex> for P2AIndex {
fn from(value: OutputTypeIndex) -> Self {
Self(value)
}
}
impl From<P2AIndex> for usize {
fn from(value: P2AIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2AIndex {
fn from(value: usize) -> Self {
Self(OutputTypeIndex::from(value))
}
}
impl Add<usize> for P2AIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2AIndex> for P2AIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.0.checked_sub(rhs.0.0).map(OutputTypeIndex).map(Self)
}
}
impl Printable for P2AIndex {
fn to_string() -> &'static str {
"p2aindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["a", "p2a", "p2aindex"]
}
}
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct OpReturnIndex(OutputTypeIndex);
impl From<OutputTypeIndex> for OpReturnIndex {
fn from(value: OutputTypeIndex) -> Self {
Self(value)
}
}
impl From<OpReturnIndex> for usize {
fn from(value: OpReturnIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for OpReturnIndex {
fn from(value: usize) -> Self {
Self(OutputTypeIndex::from(value))
}
}
impl Add<usize> for OpReturnIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<OpReturnIndex> for OpReturnIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.0.checked_sub(rhs.0.0).map(OutputTypeIndex).map(Self)
}
}
impl Printable for OpReturnIndex {
fn to_string() -> &'static str {
"opreturnindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["op", "opreturn", "opreturnindex"]
}
}
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct UnknownOutputIndex(OutputTypeIndex);
impl From<OutputTypeIndex> for UnknownOutputIndex {
fn from(value: OutputTypeIndex) -> Self {
Self(value)
}
}
impl From<UnknownOutputIndex> for usize {
fn from(value: UnknownOutputIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for UnknownOutputIndex {
fn from(value: usize) -> Self {
Self(OutputTypeIndex::from(value))
}
}
impl Add<usize> for UnknownOutputIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<UnknownOutputIndex> for UnknownOutputIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.0.checked_sub(rhs.0.0).map(OutputTypeIndex).map(Self)
}
}
impl Printable for UnknownOutputIndex {
fn to_string() -> &'static str {
"unknownoutputindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["unknown", "unknownoutputindex"]
}
}
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2PK33Index(OutputTypeIndex);
impl From<OutputTypeIndex> for P2PK33Index {
fn from(value: OutputTypeIndex) -> Self {
Self(value)
}
}
impl From<P2PK33Index> for usize {
fn from(value: P2PK33Index) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2PK33Index {
fn from(value: usize) -> Self {
Self(OutputTypeIndex::from(value))
}
}
impl Add<usize> for P2PK33Index {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2PK33Index> for P2PK33Index {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.0.checked_sub(rhs.0.0).map(OutputTypeIndex).map(Self)
}
}
impl Printable for P2PK33Index {
fn to_string() -> &'static str {
"p2pk33index"
}
fn to_possible_strings() -> &'static [&'static str] {
&["pk33", "p2pk33", "p2pk33index"]
}
}
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2PK65Index(OutputTypeIndex);
impl From<OutputTypeIndex> for P2PK65Index {
fn from(value: OutputTypeIndex) -> Self {
Self(value)
}
}
impl From<P2PK65Index> for usize {
fn from(value: P2PK65Index) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2PK65Index {
fn from(value: usize) -> Self {
Self(OutputTypeIndex::from(value))
}
}
impl Add<usize> for P2PK65Index {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2PK65Index> for P2PK65Index {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.0.checked_sub(rhs.0.0).map(OutputTypeIndex).map(Self)
}
}
impl Printable for P2PK65Index {
fn to_string() -> &'static str {
"p2pk65index"
}
fn to_possible_strings() -> &'static [&'static str] {
&["pk65", "p2pk65", "p2pk65index"]
}
}
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2PKHIndex(OutputTypeIndex);
impl From<OutputTypeIndex> for P2PKHIndex {
fn from(value: OutputTypeIndex) -> Self {
Self(value)
}
}
impl From<P2PKHIndex> for usize {
fn from(value: P2PKHIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2PKHIndex {
fn from(value: usize) -> Self {
Self(OutputTypeIndex::from(value))
}
}
impl Add<usize> for P2PKHIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2PKHIndex> for P2PKHIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.0.checked_sub(rhs.0.0).map(OutputTypeIndex).map(Self)
}
}
impl Printable for P2PKHIndex {
fn to_string() -> &'static str {
"p2pkhindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["pkh", "p2pkh", "p2pkhindex"]
}
}
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2SHIndex(OutputTypeIndex);
impl From<OutputTypeIndex> for P2SHIndex {
fn from(value: OutputTypeIndex) -> Self {
Self(value)
}
}
impl From<P2SHIndex> for usize {
fn from(value: P2SHIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2SHIndex {
fn from(value: usize) -> Self {
Self(OutputTypeIndex::from(value))
}
}
impl Add<usize> for P2SHIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2SHIndex> for P2SHIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.0.checked_sub(rhs.0.0).map(OutputTypeIndex).map(Self)
}
}
impl Printable for P2SHIndex {
fn to_string() -> &'static str {
"p2shindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["sh", "p2sh", "p2shindex"]
}
}
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2TRIndex(OutputTypeIndex);
impl From<OutputTypeIndex> for P2TRIndex {
fn from(value: OutputTypeIndex) -> Self {
Self(value)
}
}
impl From<P2TRIndex> for usize {
fn from(value: P2TRIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2TRIndex {
fn from(value: usize) -> Self {
Self(OutputTypeIndex::from(value))
}
}
impl Add<usize> for P2TRIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2TRIndex> for P2TRIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.0.checked_sub(rhs.0.0).map(OutputTypeIndex).map(Self)
}
}
impl Printable for P2TRIndex {
fn to_string() -> &'static str {
"p2trindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["tr", "p2tr", "p2trindex"]
}
}
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2WPKHIndex(OutputTypeIndex);
impl From<OutputTypeIndex> for P2WPKHIndex {
fn from(value: OutputTypeIndex) -> Self {
Self(value)
}
}
impl From<P2WPKHIndex> for usize {
fn from(value: P2WPKHIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2WPKHIndex {
fn from(value: usize) -> Self {
Self(OutputTypeIndex::from(value))
}
}
impl Add<usize> for P2WPKHIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2WPKHIndex> for P2WPKHIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.0.checked_sub(rhs.0.0).map(OutputTypeIndex).map(Self)
}
}
impl Printable for P2WPKHIndex {
fn to_string() -> &'static str {
"p2wpkhindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["wpkh", "p2wpkh", "p2wpkhindex"]
}
}
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2WSHIndex(OutputTypeIndex);
impl From<OutputTypeIndex> for P2WSHIndex {
fn from(value: OutputTypeIndex) -> Self {
Self(value)
}
}
impl From<P2WSHIndex> for usize {
fn from(value: P2WSHIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2WSHIndex {
fn from(value: usize) -> Self {
Self(OutputTypeIndex::from(value))
}
}
impl Add<usize> for P2WSHIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2WSHIndex> for P2WSHIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.0.checked_sub(rhs.0.0).map(OutputTypeIndex).map(Self)
}
}
impl Printable for P2WSHIndex {
fn to_string() -> &'static str {
"p2wshindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["wsh", "p2wsh", "p2wshindex"]
}
}

View File

@@ -0,0 +1,61 @@
use std::ops::Add;
use derive_deref::{Deref, DerefMut};
use serde::Serialize;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable, TypeIndex};
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2AAddressIndex(TypeIndex);
impl From<TypeIndex> for P2AAddressIndex {
fn from(value: TypeIndex) -> Self {
Self(value)
}
}
impl From<P2AAddressIndex> for usize {
fn from(value: P2AAddressIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2AAddressIndex {
fn from(value: usize) -> Self {
Self(TypeIndex::from(value))
}
}
impl Add<usize> for P2AAddressIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2AAddressIndex> for P2AAddressIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}
impl Printable for P2AAddressIndex {
fn to_string() -> &'static str {
"p2aaddressindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["aaddr", "p2aaddr", "p2aaddressindex"]
}
}

View File

@@ -0,0 +1,62 @@
use std::ops::Add;
use derive_deref::{Deref, DerefMut};
use serde::Serialize;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable, TypeIndex};
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2MSOutputIndex(TypeIndex);
impl From<TypeIndex> for P2MSOutputIndex {
fn from(value: TypeIndex) -> Self {
Self(value)
}
}
impl From<P2MSOutputIndex> for usize {
fn from(value: P2MSOutputIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2MSOutputIndex {
fn from(value: usize) -> Self {
Self(TypeIndex::from(value))
}
}
impl Add<usize> for P2MSOutputIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2MSOutputIndex> for P2MSOutputIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}
impl Printable for P2MSOutputIndex {
fn to_string() -> &'static str {
"p2msoutputindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["msout", "p2msout", "p2msoutputindex"]
}
}

View File

@@ -0,0 +1,62 @@
use std::ops::Add;
use derive_deref::{Deref, DerefMut};
use serde::Serialize;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable, TypeIndex};
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2PK33AddressIndex(TypeIndex);
impl From<TypeIndex> for P2PK33AddressIndex {
fn from(value: TypeIndex) -> Self {
Self(value)
}
}
impl From<P2PK33AddressIndex> for usize {
fn from(value: P2PK33AddressIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2PK33AddressIndex {
fn from(value: usize) -> Self {
Self(TypeIndex::from(value))
}
}
impl Add<usize> for P2PK33AddressIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2PK33AddressIndex> for P2PK33AddressIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}
impl Printable for P2PK33AddressIndex {
fn to_string() -> &'static str {
"p2pk33addressindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["pk33addr", "p2pk33addr", "p2pk33addressindex"]
}
}

View File

@@ -0,0 +1,61 @@
use std::ops::Add;
use derive_deref::{Deref, DerefMut};
use serde::Serialize;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable, TypeIndex};
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2PK65AddressIndex(TypeIndex);
impl From<TypeIndex> for P2PK65AddressIndex {
fn from(value: TypeIndex) -> Self {
Self(value)
}
}
impl From<P2PK65AddressIndex> for usize {
fn from(value: P2PK65AddressIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2PK65AddressIndex {
fn from(value: usize) -> Self {
Self(TypeIndex::from(value))
}
}
impl Add<usize> for P2PK65AddressIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2PK65AddressIndex> for P2PK65AddressIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}
impl Printable for P2PK65AddressIndex {
fn to_string() -> &'static str {
"p2pk65addressindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["pk65addr", "p2pk65addr", "p2pk65addressindex"]
}
}

View File

@@ -0,0 +1,62 @@
use std::ops::Add;
use derive_deref::{Deref, DerefMut};
use serde::Serialize;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable, TypeIndex};
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2PKHAddressIndex(TypeIndex);
impl From<TypeIndex> for P2PKHAddressIndex {
fn from(value: TypeIndex) -> Self {
Self(value)
}
}
impl From<P2PKHAddressIndex> for usize {
fn from(value: P2PKHAddressIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2PKHAddressIndex {
fn from(value: usize) -> Self {
Self(TypeIndex::from(value))
}
}
impl Add<usize> for P2PKHAddressIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2PKHAddressIndex> for P2PKHAddressIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}
impl Printable for P2PKHAddressIndex {
fn to_string() -> &'static str {
"p2pkhaddressindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["pkhaddr", "p2pkhaddr", "p2pkhaddressindex"]
}
}

View File

@@ -0,0 +1,62 @@
use std::ops::Add;
use derive_deref::{Deref, DerefMut};
use serde::Serialize;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable, TypeIndex};
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2SHAddressIndex(TypeIndex);
impl From<TypeIndex> for P2SHAddressIndex {
fn from(value: TypeIndex) -> Self {
Self(value)
}
}
impl From<P2SHAddressIndex> for usize {
fn from(value: P2SHAddressIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2SHAddressIndex {
fn from(value: usize) -> Self {
Self(TypeIndex::from(value))
}
}
impl Add<usize> for P2SHAddressIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2SHAddressIndex> for P2SHAddressIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}
impl Printable for P2SHAddressIndex {
fn to_string() -> &'static str {
"p2shaddressindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["shaddr", "p2shaddr", "p2shaddressindex"]
}
}

View File

@@ -0,0 +1,62 @@
use std::ops::Add;
use derive_deref::{Deref, DerefMut};
use serde::Serialize;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable, TypeIndex};
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2TRAddressIndex(TypeIndex);
impl From<TypeIndex> for P2TRAddressIndex {
fn from(value: TypeIndex) -> Self {
Self(value)
}
}
impl From<P2TRAddressIndex> for usize {
fn from(value: P2TRAddressIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2TRAddressIndex {
fn from(value: usize) -> Self {
Self(TypeIndex::from(value))
}
}
impl Add<usize> for P2TRAddressIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2TRAddressIndex> for P2TRAddressIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}
impl Printable for P2TRAddressIndex {
fn to_string() -> &'static str {
"p2traddressindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["traddr", "p2traddr", "p2traddressindex"]
}
}

View File

@@ -0,0 +1,62 @@
use std::ops::Add;
use derive_deref::{Deref, DerefMut};
use serde::Serialize;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable, TypeIndex};
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2WPKHAddressIndex(TypeIndex);
impl From<TypeIndex> for P2WPKHAddressIndex {
fn from(value: TypeIndex) -> Self {
Self(value)
}
}
impl From<P2WPKHAddressIndex> for usize {
fn from(value: P2WPKHAddressIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2WPKHAddressIndex {
fn from(value: usize) -> Self {
Self(TypeIndex::from(value))
}
}
impl Add<usize> for P2WPKHAddressIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2WPKHAddressIndex> for P2WPKHAddressIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}
impl Printable for P2WPKHAddressIndex {
fn to_string() -> &'static str {
"p2wpkhaddressindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["wpkhaddr", "p2wpkhaddr", "p2wpkhaddressindex"]
}
}

View File

@@ -0,0 +1,62 @@
use std::ops::Add;
use derive_deref::{Deref, DerefMut};
use serde::Serialize;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable, TypeIndex};
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct P2WSHAddressIndex(TypeIndex);
impl From<TypeIndex> for P2WSHAddressIndex {
fn from(value: TypeIndex) -> Self {
Self(value)
}
}
impl From<P2WSHAddressIndex> for usize {
fn from(value: P2WSHAddressIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for P2WSHAddressIndex {
fn from(value: usize) -> Self {
Self(TypeIndex::from(value))
}
}
impl Add<usize> for P2WSHAddressIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<P2WSHAddressIndex> for P2WSHAddressIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}
impl Printable for P2WSHAddressIndex {
fn to_string() -> &'static str {
"p2wshaddressindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["wshaddr", "p2wshaddr", "p2wshaddressindex"]
}
}

View File

@@ -7,8 +7,9 @@ use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable};
use super::{
EmptyOutputIndex, OpReturnIndex, P2AIndex, P2MSIndex, P2PK33Index, P2PK65Index, P2PKHIndex,
P2SHIndex, P2TRIndex, P2WPKHIndex, P2WSHIndex, UnknownOutputIndex,
EmptyOutputIndex, OpReturnIndex, P2AAddressIndex, P2MSOutputIndex, P2PK33AddressIndex,
P2PK65AddressIndex, P2PKHAddressIndex, P2SHAddressIndex, P2TRAddressIndex, P2WPKHAddressIndex,
P2WSHAddressIndex, UnknownOutputIndex,
};
#[derive(
@@ -93,20 +94,20 @@ impl From<StoredU32> for usize {
}
}
impl From<P2PK65Index> for StoredU32 {
fn from(value: P2PK65Index) -> Self {
impl From<P2PK65AddressIndex> for StoredU32 {
fn from(value: P2PK65AddressIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2PK33Index> for StoredU32 {
fn from(value: P2PK33Index) -> Self {
impl From<P2PK33AddressIndex> for StoredU32 {
fn from(value: P2PK33AddressIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2PKHIndex> for StoredU32 {
fn from(value: P2PKHIndex) -> Self {
impl From<P2PKHAddressIndex> for StoredU32 {
fn from(value: P2PKHAddressIndex) -> Self {
Self::from(usize::from(value))
}
}
@@ -117,38 +118,38 @@ impl From<OpReturnIndex> for StoredU32 {
}
}
impl From<P2MSIndex> for StoredU32 {
fn from(value: P2MSIndex) -> Self {
impl From<P2MSOutputIndex> for StoredU32 {
fn from(value: P2MSOutputIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2SHIndex> for StoredU32 {
fn from(value: P2SHIndex) -> Self {
impl From<P2SHAddressIndex> for StoredU32 {
fn from(value: P2SHAddressIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2WSHIndex> for StoredU32 {
fn from(value: P2WSHIndex) -> Self {
impl From<P2WSHAddressIndex> for StoredU32 {
fn from(value: P2WSHAddressIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2WPKHIndex> for StoredU32 {
fn from(value: P2WPKHIndex) -> Self {
impl From<P2WPKHAddressIndex> for StoredU32 {
fn from(value: P2WPKHAddressIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2TRIndex> for StoredU32 {
fn from(value: P2TRIndex) -> Self {
impl From<P2TRAddressIndex> for StoredU32 {
fn from(value: P2TRAddressIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2AIndex> for StoredU32 {
fn from(value: P2AIndex) -> Self {
impl From<P2AAddressIndex> for StoredU32 {
fn from(value: P2AAddressIndex) -> Self {
Self::from(usize::from(value))
}
}

View File

@@ -8,8 +8,9 @@ use crate::{CheckedSub, Printable};
use super::{
DateIndex, EmptyOutputIndex, Height, InputIndex, MonthIndex, OpReturnIndex, OutputIndex,
P2AIndex, P2MSIndex, P2PK33Index, P2PK65Index, P2PKHIndex, P2SHIndex, P2TRIndex, P2WPKHIndex,
P2WSHIndex, TxIndex, UnknownOutputIndex, YearIndex,
P2AAddressIndex, P2MSOutputIndex, P2PK33AddressIndex, P2PK65AddressIndex, P2PKHAddressIndex,
P2SHAddressIndex, P2TRAddressIndex, P2WPKHAddressIndex, P2WSHAddressIndex, TxIndex,
UnknownOutputIndex, YearIndex,
};
#[derive(
@@ -122,20 +123,20 @@ impl From<TxIndex> for StoredUsize {
}
}
impl From<P2PK65Index> for StoredUsize {
fn from(value: P2PK65Index) -> Self {
impl From<P2PK65AddressIndex> for StoredUsize {
fn from(value: P2PK65AddressIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2PK33Index> for StoredUsize {
fn from(value: P2PK33Index) -> Self {
impl From<P2PK33AddressIndex> for StoredUsize {
fn from(value: P2PK33AddressIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2PKHIndex> for StoredUsize {
fn from(value: P2PKHIndex) -> Self {
impl From<P2PKHAddressIndex> for StoredUsize {
fn from(value: P2PKHAddressIndex) -> Self {
Self::from(usize::from(value))
}
}
@@ -146,38 +147,38 @@ impl From<OpReturnIndex> for StoredUsize {
}
}
impl From<P2MSIndex> for StoredUsize {
fn from(value: P2MSIndex) -> Self {
impl From<P2MSOutputIndex> for StoredUsize {
fn from(value: P2MSOutputIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2SHIndex> for StoredUsize {
fn from(value: P2SHIndex) -> Self {
impl From<P2SHAddressIndex> for StoredUsize {
fn from(value: P2SHAddressIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2WSHIndex> for StoredUsize {
fn from(value: P2WSHIndex) -> Self {
impl From<P2WSHAddressIndex> for StoredUsize {
fn from(value: P2WSHAddressIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2WPKHIndex> for StoredUsize {
fn from(value: P2WPKHIndex) -> Self {
impl From<P2WPKHAddressIndex> for StoredUsize {
fn from(value: P2WPKHAddressIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2TRIndex> for StoredUsize {
fn from(value: P2TRIndex) -> Self {
impl From<P2TRAddressIndex> for StoredUsize {
fn from(value: P2TRAddressIndex) -> Self {
Self::from(usize::from(value))
}
}
impl From<P2AIndex> for StoredUsize {
fn from(value: P2AIndex) -> Self {
impl From<P2AAddressIndex> for StoredUsize {
fn from(value: P2AAddressIndex) -> Self {
Self::from(usize::from(value))
}
}

View File

@@ -0,0 +1,99 @@
use std::ops::Add;
use byteview::ByteView;
use serde::Serialize;
use zerocopy::{FromBytes, IntoBytes};
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::CheckedSub;
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct TypeIndex(u32);
impl TypeIndex {
pub fn increment(&mut self) {
self.0 += 1;
}
pub fn incremented(self) -> Self {
Self(self.0 + 1)
}
pub fn copy_then_increment(&mut self) -> Self {
let i = *self;
self.increment();
i
}
}
impl From<u32> for TypeIndex {
fn from(value: u32) -> Self {
Self(value)
}
}
impl From<u64> for TypeIndex {
fn from(value: u64) -> Self {
Self(value as u32)
}
}
impl From<TypeIndex> for u64 {
fn from(value: TypeIndex) -> Self {
value.0 as u64
}
}
impl From<usize> for TypeIndex {
fn from(value: usize) -> Self {
Self(value as u32)
}
}
impl From<TypeIndex> for usize {
fn from(value: TypeIndex) -> Self {
value.0 as usize
}
}
impl Add<usize> for TypeIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(self.0 + rhs as u32)
}
}
impl Add<TypeIndex> for TypeIndex {
type Output = Self;
fn add(self, rhs: TypeIndex) -> Self::Output {
Self(self.0 + rhs.0)
}
}
impl From<ByteView> for TypeIndex {
fn from(value: ByteView) -> Self {
Self::read_from_bytes(&value).unwrap()
}
}
impl From<TypeIndex> for ByteView {
fn from(value: TypeIndex) -> Self {
Self::new(value.as_bytes())
}
}
impl CheckedSub<TypeIndex> for TypeIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}

View File

@@ -0,0 +1,62 @@
use std::ops::Add;
use derive_deref::{Deref, DerefMut};
use serde::Serialize;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
use crate::{CheckedSub, Printable, TypeIndex};
#[derive(
Debug,
PartialEq,
Eq,
PartialOrd,
Ord,
Clone,
Copy,
Deref,
DerefMut,
Default,
FromBytes,
Immutable,
IntoBytes,
KnownLayout,
Serialize,
)]
pub struct UnknownOutputIndex(TypeIndex);
impl From<TypeIndex> for UnknownOutputIndex {
fn from(value: TypeIndex) -> Self {
Self(value)
}
}
impl From<UnknownOutputIndex> for usize {
fn from(value: UnknownOutputIndex) -> Self {
Self::from(*value)
}
}
impl From<usize> for UnknownOutputIndex {
fn from(value: usize) -> Self {
Self(TypeIndex::from(value))
}
}
impl Add<usize> for UnknownOutputIndex {
type Output = Self;
fn add(self, rhs: usize) -> Self::Output {
Self(*self + rhs)
}
}
impl CheckedSub<UnknownOutputIndex> for UnknownOutputIndex {
fn checked_sub(self, rhs: Self) -> Option<Self> {
self.0.checked_sub(rhs.0).map(Self)
}
}
impl Printable for UnknownOutputIndex {
fn to_string() -> &'static str {
"unknownoutputindex"
}
fn to_possible_strings() -> &'static [&'static str] {
&["unknownout", "unknownoutputindex"]
}
}

View File

@@ -1,8 +1,9 @@
use bitcoincore_rpc::Client;
use brk_core::{
BlockHash, CheckedSub, EmptyOutputIndex, Height, InputIndex, OpReturnIndex, OutputIndex,
OutputType, OutputTypeIndex, P2AIndex, P2MSIndex, P2PK33Index, P2PK65Index, P2PKHIndex,
P2SHIndex, P2TRIndex, P2WPKHIndex, P2WSHIndex, Result, TxIndex, UnknownOutputIndex,
OutputType, P2AAddressIndex, P2MSOutputIndex, P2PK33AddressIndex, P2PK65AddressIndex,
P2PKHAddressIndex, P2SHAddressIndex, P2TRAddressIndex, P2WPKHAddressIndex, P2WSHAddressIndex,
Result, TxIndex, TypeIndex, UnknownOutputIndex,
};
use brk_parser::NUMBER_OF_UNSAFE_BLOCKS;
use brk_vec::{AnyIndexedVec, AnyIterableVec, AnyVec, IndexedVec, StoredIndex, StoredType};
@@ -15,15 +16,15 @@ pub struct Indexes {
pub emptyoutputindex: EmptyOutputIndex,
pub height: Height,
pub opreturnindex: OpReturnIndex,
pub p2msindex: P2MSIndex,
pub p2pk33index: P2PK33Index,
pub p2pk65index: P2PK65Index,
pub p2pkhindex: P2PKHIndex,
pub p2shindex: P2SHIndex,
pub p2trindex: P2TRIndex,
pub p2wpkhindex: P2WPKHIndex,
pub p2wshindex: P2WSHIndex,
pub p2aindex: P2AIndex,
pub p2msoutputindex: P2MSOutputIndex,
pub p2pk33addressindex: P2PK33AddressIndex,
pub p2pk65addressindex: P2PK65AddressIndex,
pub p2pkhaddressindex: P2PKHAddressIndex,
pub p2shaddressindex: P2SHAddressIndex,
pub p2traddressindex: P2TRAddressIndex,
pub p2wpkhaddressindex: P2WPKHAddressIndex,
pub p2wshaddressindex: P2WSHAddressIndex,
pub p2aaddressindex: P2AAddressIndex,
pub txindex: TxIndex,
pub inputindex: InputIndex,
pub outputindex: OutputIndex,
@@ -31,19 +32,19 @@ pub struct Indexes {
}
impl Indexes {
pub fn outputtypeindex(&self, outputtype: OutputType) -> OutputTypeIndex {
pub fn typeindex(&self, outputtype: OutputType) -> TypeIndex {
match outputtype {
OutputType::Empty => *self.emptyoutputindex,
OutputType::OpReturn => *self.opreturnindex,
OutputType::P2A => *self.p2aindex,
OutputType::P2MS => *self.p2msindex,
OutputType::P2PK33 => *self.p2pkhindex,
OutputType::P2PK65 => *self.p2pk65index,
OutputType::P2PKH => *self.p2pkhindex,
OutputType::P2SH => *self.p2shindex,
OutputType::P2TR => *self.p2trindex,
OutputType::P2WPKH => *self.p2wpkhindex,
OutputType::P2WSH => *self.p2wshindex,
OutputType::P2A => *self.p2aaddressindex,
OutputType::P2MS => *self.p2msoutputindex,
OutputType::P2PK33 => *self.p2pkhaddressindex,
OutputType::P2PK65 => *self.p2pk65addressindex,
OutputType::P2PKH => *self.p2pkhaddressindex,
OutputType::P2SH => *self.p2shaddressindex,
OutputType::P2TR => *self.p2traddressindex,
OutputType::P2WPKH => *self.p2wpkhaddressindex,
OutputType::P2WSH => *self.p2wshaddressindex,
OutputType::Unknown => *self.unknownoutputindex,
}
}
@@ -58,28 +59,28 @@ impl Indexes {
.push_if_needed(height, self.outputindex)?;
vecs.height_to_first_emptyoutputindex
.push_if_needed(height, self.emptyoutputindex)?;
vecs.height_to_first_p2msindex
.push_if_needed(height, self.p2msindex)?;
vecs.height_to_first_p2msoutputindex
.push_if_needed(height, self.p2msoutputindex)?;
vecs.height_to_first_opreturnindex
.push_if_needed(height, self.opreturnindex)?;
vecs.height_to_first_p2aindex
.push_if_needed(height, self.p2aindex)?;
vecs.height_to_first_p2aaddressindex
.push_if_needed(height, self.p2aaddressindex)?;
vecs.height_to_first_unknownoutputindex
.push_if_needed(height, self.unknownoutputindex)?;
vecs.height_to_first_p2pk33index
.push_if_needed(height, self.p2pk33index)?;
vecs.height_to_first_p2pk65index
.push_if_needed(height, self.p2pk65index)?;
vecs.height_to_first_p2pkhindex
.push_if_needed(height, self.p2pkhindex)?;
vecs.height_to_first_p2shindex
.push_if_needed(height, self.p2shindex)?;
vecs.height_to_first_p2trindex
.push_if_needed(height, self.p2trindex)?;
vecs.height_to_first_p2wpkhindex
.push_if_needed(height, self.p2wpkhindex)?;
vecs.height_to_first_p2wshindex
.push_if_needed(height, self.p2wshindex)?;
vecs.height_to_first_p2pk33addressindex
.push_if_needed(height, self.p2pk33addressindex)?;
vecs.height_to_first_p2pk65addressindex
.push_if_needed(height, self.p2pk65addressindex)?;
vecs.height_to_first_p2pkhaddressindex
.push_if_needed(height, self.p2pkhaddressindex)?;
vecs.height_to_first_p2shaddressindex
.push_if_needed(height, self.p2shaddressindex)?;
vecs.height_to_first_p2traddressindex
.push_if_needed(height, self.p2traddressindex)?;
vecs.height_to_first_p2wpkhaddressindex
.push_if_needed(height, self.p2wpkhaddressindex)?;
vecs.height_to_first_p2wshaddressindex
.push_if_needed(height, self.p2wshaddressindex)?;
Ok(())
}
@@ -122,9 +123,9 @@ impl TryFrom<(&mut Vecs, &Stores, &Client)> for Indexes {
)
.context("")?,
height,
p2msindex: starting_index(
&vecs.height_to_first_p2msindex,
&vecs.p2msindex_to_txindex,
p2msoutputindex: starting_index(
&vecs.height_to_first_p2msoutputindex,
&vecs.p2msoutputindex_to_txindex,
height,
)
.context("")?,
@@ -134,51 +135,51 @@ impl TryFrom<(&mut Vecs, &Stores, &Client)> for Indexes {
height,
)
.context("")?,
p2pk33index: starting_index(
&vecs.height_to_first_p2pk33index,
&vecs.p2pk33index_to_p2pk33bytes,
p2pk33addressindex: starting_index(
&vecs.height_to_first_p2pk33addressindex,
&vecs.p2pk33addressindex_to_p2pk33bytes,
height,
)
.context("")?,
p2pk65index: starting_index(
&vecs.height_to_first_p2pk65index,
&vecs.p2pk65index_to_p2pk65bytes,
p2pk65addressindex: starting_index(
&vecs.height_to_first_p2pk65addressindex,
&vecs.p2pk65addressindex_to_p2pk65bytes,
height,
)
.context("")?,
p2pkhindex: starting_index(
&vecs.height_to_first_p2pkhindex,
&vecs.p2pkhindex_to_p2pkhbytes,
p2pkhaddressindex: starting_index(
&vecs.height_to_first_p2pkhaddressindex,
&vecs.p2pkhaddressindex_to_p2pkhbytes,
height,
)
.context("")?,
p2shindex: starting_index(
&vecs.height_to_first_p2shindex,
&vecs.p2shindex_to_p2shbytes,
p2shaddressindex: starting_index(
&vecs.height_to_first_p2shaddressindex,
&vecs.p2shaddressindex_to_p2shbytes,
height,
)
.context("")?,
p2trindex: starting_index(
&vecs.height_to_first_p2trindex,
&vecs.p2trindex_to_p2trbytes,
p2traddressindex: starting_index(
&vecs.height_to_first_p2traddressindex,
&vecs.p2traddressindex_to_p2trbytes,
height,
)
.context("")?,
p2wpkhindex: starting_index(
&vecs.height_to_first_p2wpkhindex,
&vecs.p2wpkhindex_to_p2wpkhbytes,
p2wpkhaddressindex: starting_index(
&vecs.height_to_first_p2wpkhaddressindex,
&vecs.p2wpkhaddressindex_to_p2wpkhbytes,
height,
)
.context("")?,
p2wshindex: starting_index(
&vecs.height_to_first_p2wshindex,
&vecs.p2wshindex_to_p2wshbytes,
p2wshaddressindex: starting_index(
&vecs.height_to_first_p2wshaddressindex,
&vecs.p2wshaddressindex_to_p2wshbytes,
height,
)
.context("")?,
p2aindex: starting_index(
&vecs.height_to_first_p2aindex,
&vecs.p2aindex_to_p2abytes,
p2aaddressindex: starting_index(
&vecs.height_to_first_p2aaddressindex,
&vecs.p2aaddressindex_to_p2abytes,
height,
)
.context("")?,

View File

@@ -7,7 +7,7 @@ use std::{collections::BTreeMap, path::Path, str::FromStr, thread};
use brk_core::{
AddressBytes, AddressBytesHash, BlockHash, BlockHashPrefix, Height, InputIndex, OutputIndex,
OutputType, OutputTypeIndex, Sats, Timestamp, TxIndex, Txid, TxidPrefix, Version, Vin, Vout,
OutputType, Sats, Timestamp, TxIndex, Txid, TxidPrefix, TypeIndex, Version, Vin, Vout,
setrlimit,
};
@@ -267,15 +267,15 @@ impl Indexer {
});
let outputindex_to_txout_outputtype_addressbytes_res_addressindex_opt_handle = scope.spawn(|| {
let p2pk65index_to_p2pk65bytes_mmap = vecs
.p2pk65index_to_p2pk65bytes.mmap().load();
let p2pk33index_to_p2pk33bytes_mmap = vecs.p2pk33index_to_p2pk33bytes.mmap().load();
let p2pkhindex_to_p2pkhbytes_mmap = vecs.p2pkhindex_to_p2pkhbytes.mmap().load();
let p2shindex_to_p2shbytes_mmap = vecs.p2shindex_to_p2shbytes.mmap().load();
let p2wpkhindex_to_p2wpkhbytes_mmap = vecs.p2wpkhindex_to_p2wpkhbytes.mmap().load();
let p2wshindex_to_p2wshbytes_mmap = vecs.p2wshindex_to_p2wshbytes.mmap().load();
let p2trindex_to_p2trbytes_mmap = vecs.p2trindex_to_p2trbytes.mmap().load();
let p2aindex_to_p2abytes_mmap = vecs.p2aindex_to_p2abytes.mmap().load();
let p2pk65addressindex_to_p2pk65bytes_mmap = vecs
.p2pk65addressindex_to_p2pk65bytes.mmap().load();
let p2pk33addressindex_to_p2pk33bytes_mmap = vecs.p2pk33addressindex_to_p2pk33bytes.mmap().load();
let p2pkhaddressindex_to_p2pkhbytes_mmap = vecs.p2pkhaddressindex_to_p2pkhbytes.mmap().load();
let p2shaddressindex_to_p2shbytes_mmap = vecs.p2shaddressindex_to_p2shbytes.mmap().load();
let p2wpkhaddressindex_to_p2wpkhbytes_mmap = vecs.p2wpkhaddressindex_to_p2wpkhbytes.mmap().load();
let p2wshaddressindex_to_p2wshbytes_mmap = vecs.p2wshaddressindex_to_p2wshbytes.mmap().load();
let p2traddressindex_to_p2trbytes_mmap = vecs.p2traddressindex_to_p2trbytes.mmap().load();
let p2aaddressindex_to_p2abytes_mmap = vecs.p2aaddressindex_to_p2abytes.mmap().load();
outputs
.into_par_iter()
@@ -290,7 +290,7 @@ impl Indexer {
Vout,
OutputType,
brk_core::Result<AddressBytes>,
Option<OutputTypeIndex>,
Option<TypeIndex>,
&Transaction,
),
)> {
@@ -306,53 +306,53 @@ impl Indexer {
// dbg!(&txout, height, txi, &tx.compute_txid());
});
let outputtypeindex_opt = address_bytes_res.as_ref().ok().and_then(|addressbytes| {
let typeindex_opt = address_bytes_res.as_ref().ok().and_then(|addressbytes| {
stores
.addressbyteshash_to_outputtypeindex
.addressbyteshash_to_typeindex
.get(&AddressBytesHash::from((addressbytes, outputtype)))
.unwrap()
.map(|v| *v)
// Checking if not in the future
.and_then(|outputtypeindex_local| {
(outputtypeindex_local < idxs.outputtypeindex(outputtype)).then_some(outputtypeindex_local)
.and_then(|typeindex_local| {
(typeindex_local < idxs.typeindex(outputtype)).then_some(typeindex_local)
})
});
if let Some(Some(outputtypeindex)) = check_collisions.then_some(outputtypeindex_opt) {
if let Some(Some(typeindex)) = check_collisions.then_some(typeindex_opt) {
let addressbytes = address_bytes_res.as_ref().unwrap();
let prev_addressbytes_opt = match outputtype {
OutputType::P2PK65 => vecs
.p2pk65index_to_p2pk65bytes
.get_or_read(outputtypeindex.into(), &p2pk65index_to_p2pk65bytes_mmap)?
.p2pk65addressindex_to_p2pk65bytes
.get_or_read(typeindex.into(), &p2pk65addressindex_to_p2pk65bytes_mmap)?
.map(|v| AddressBytes::from(v.into_inner())),
OutputType::P2PK33 => vecs
.p2pk33index_to_p2pk33bytes
.get_or_read(outputtypeindex.into(), &p2pk33index_to_p2pk33bytes_mmap)?
.p2pk33addressindex_to_p2pk33bytes
.get_or_read(typeindex.into(), &p2pk33addressindex_to_p2pk33bytes_mmap)?
.map(|v| AddressBytes::from(v.into_inner())),
OutputType::P2PKH => vecs
.p2pkhindex_to_p2pkhbytes
.get_or_read(outputtypeindex.into(), &p2pkhindex_to_p2pkhbytes_mmap)?
.p2pkhaddressindex_to_p2pkhbytes
.get_or_read(typeindex.into(), &p2pkhaddressindex_to_p2pkhbytes_mmap)?
.map(|v| AddressBytes::from(v.into_inner())),
OutputType::P2SH => vecs
.p2shindex_to_p2shbytes
.get_or_read(outputtypeindex.into(), &p2shindex_to_p2shbytes_mmap)?
.p2shaddressindex_to_p2shbytes
.get_or_read(typeindex.into(), &p2shaddressindex_to_p2shbytes_mmap)?
.map(|v| AddressBytes::from(v.into_inner())),
OutputType::P2WPKH => vecs
.p2wpkhindex_to_p2wpkhbytes
.get_or_read(outputtypeindex.into(), &p2wpkhindex_to_p2wpkhbytes_mmap)?
.p2wpkhaddressindex_to_p2wpkhbytes
.get_or_read(typeindex.into(), &p2wpkhaddressindex_to_p2wpkhbytes_mmap)?
.map(|v| AddressBytes::from(v.into_inner())),
OutputType::P2WSH => vecs
.p2wshindex_to_p2wshbytes
.get_or_read(outputtypeindex.into(), &p2wshindex_to_p2wshbytes_mmap)?
.p2wshaddressindex_to_p2wshbytes
.get_or_read(typeindex.into(), &p2wshaddressindex_to_p2wshbytes_mmap)?
.map(|v| AddressBytes::from(v.into_inner())),
OutputType::P2TR => vecs
.p2trindex_to_p2trbytes
.get_or_read(outputtypeindex.into(), &p2trindex_to_p2trbytes_mmap)?
.p2traddressindex_to_p2trbytes
.get_or_read(typeindex.into(), &p2traddressindex_to_p2trbytes_mmap)?
.map(|v| AddressBytes::from(v.into_inner())),
OutputType::P2A => vecs
.p2aindex_to_p2abytes
.get_or_read(outputtypeindex.into(), &p2aindex_to_p2abytes_mmap)?
.p2aaddressindex_to_p2abytes
.get_or_read(typeindex.into(), &p2aaddressindex_to_p2abytes_mmap)?
.map(|v| AddressBytes::from(v.into_inner())),
OutputType::Empty | OutputType::OpReturn | OutputType::P2MS | OutputType::Unknown => {
unreachable!()
@@ -361,7 +361,7 @@ impl Indexer {
let prev_addressbytes =
prev_addressbytes_opt.as_ref().context("Expect to have addressbytes")?;
if stores.addressbyteshash_to_outputtypeindex.needs(height)
if stores.addressbyteshash_to_typeindex.needs(height)
&& prev_addressbytes != addressbytes
{
let txid = tx.compute_txid();
@@ -374,8 +374,8 @@ impl Indexer {
prev_addressbytes,
addressbytes,
&idxs,
outputtypeindex,
outputtypeindex,
typeindex,
typeindex,
txout,
AddressBytesHash::from((addressbytes, outputtype)),
);
@@ -391,7 +391,7 @@ impl Indexer {
vout,
outputtype,
address_bytes_res,
outputtypeindex_opt,
typeindex_opt,
tx,
),
))
@@ -443,14 +443,14 @@ impl Indexer {
OutputIndex,
> = BTreeMap::new();
let mut already_added_addressbyteshash: BTreeMap<AddressBytesHash, OutputTypeIndex> = BTreeMap::new();
let mut already_added_addressbyteshash: BTreeMap<AddressBytesHash, TypeIndex> = BTreeMap::new();
outputindex_to_txout_outputtype_addressbytes_res_addressindex_opt
.into_iter()
.try_for_each(
|(
outputindex,
(txout, txindex, vout, outputtype, addressbytes_res, outputtypeindex_opt, _tx),
(txout, txindex, vout, outputtype, addressbytes_res, typeindex_opt, _tx),
)|
-> color_eyre::Result<()> {
let sats = Sats::from(txout.value);
@@ -466,9 +466,9 @@ impl Indexer {
let mut addressbyteshash = None;
let outputtypeindex;
let typeindex;
if let Some(outputtypeindex_local) = outputtypeindex_opt.or_else(|| {
if let Some(typeindex_local) = typeindex_opt.or_else(|| {
addressbytes_res.as_ref().ok().and_then(|addressbytes| {
// Check if address was first seen before in this iterator
// Example: https://mempool.space/address/046a0765b5865641ce08dd39690aade26dfbf5511430ca428a3089261361cef170e3929a68aee3d8d4848b0c5111b0a37b82b86ad559fd2a745b44d8e8d9dfdc0c
@@ -478,40 +478,40 @@ impl Indexer {
.cloned()
})
}) {
outputtypeindex = outputtypeindex_local;
typeindex = typeindex_local;
} else {
outputtypeindex = match outputtype {
typeindex = match outputtype {
OutputType::P2PK65 => {
idxs.p2pk65index.copy_then_increment()
idxs.p2pk65addressindex.copy_then_increment()
},
OutputType::P2PK33 => {
idxs.p2pk33index.copy_then_increment()
idxs.p2pk33addressindex.copy_then_increment()
},
OutputType::P2PKH => {
idxs.p2pkhindex.copy_then_increment()
idxs.p2pkhaddressindex.copy_then_increment()
},
OutputType::P2MS => {
vecs.p2msindex_to_txindex.push_if_needed(idxs.p2msindex, txindex)?;
idxs.p2msindex.copy_then_increment()
vecs.p2msoutputindex_to_txindex.push_if_needed(idxs.p2msoutputindex, txindex)?;
idxs.p2msoutputindex.copy_then_increment()
},
OutputType::P2SH => {
idxs.p2shindex.copy_then_increment()
idxs.p2shaddressindex.copy_then_increment()
},
OutputType::OpReturn => {
vecs.opreturnindex_to_txindex.push_if_needed(idxs.opreturnindex, txindex)?;
idxs.opreturnindex.copy_then_increment()
},
OutputType::P2WPKH => {
idxs.p2wpkhindex.copy_then_increment()
idxs.p2wpkhaddressindex.copy_then_increment()
},
OutputType::P2WSH => {
idxs.p2wshindex.copy_then_increment()
idxs.p2wshaddressindex.copy_then_increment()
},
OutputType::P2TR => {
idxs.p2trindex.copy_then_increment()
idxs.p2traddressindex.copy_then_increment()
},
OutputType::P2A => {
idxs.p2aindex.copy_then_increment()
idxs.p2aaddressindex.copy_then_increment()
},
OutputType::Empty => {
vecs.emptyoutputindex_to_txindex
@@ -528,20 +528,20 @@ impl Indexer {
let addressbyteshash = addressbyteshash.unwrap();
already_added_addressbyteshash
.insert(addressbyteshash, outputtypeindex);
.insert(addressbyteshash, typeindex);
stores.addressbyteshash_to_outputtypeindex.insert_if_needed(
stores.addressbyteshash_to_typeindex.insert_if_needed(
addressbyteshash,
outputtypeindex,
typeindex,
height,
);
vecs.push_bytes_if_needed(outputtypeindex, addressbytes)?;
vecs.push_bytes_if_needed(typeindex, addressbytes)?;
}
}
vecs.outputindex_to_outputtypeindex
.push_if_needed(outputindex, outputtypeindex)?;
vecs.outputindex_to_typeindex
.push_if_needed(outputindex, typeindex)?;
new_txindexvout_to_outputindex
.insert((txindex, vout), outputindex);

View File

@@ -1,8 +1,8 @@
use std::{fs, path::Path, thread};
use brk_core::{
AddressBytes, AddressBytesHash, BlockHashPrefix, Height, OutputType, OutputTypeIndex, Result,
TxIndex, TxidPrefix, Value, Version,
AddressBytes, AddressBytesHash, BlockHashPrefix, Height, OutputType, Result, TxIndex,
TxidPrefix, TypeIndex, Value, Version,
};
use brk_store::Store;
use brk_vec::AnyIterableVec;
@@ -15,7 +15,7 @@ use super::Vecs;
#[derive(Clone)]
pub struct Stores {
pub keyspace: TransactionalKeyspace,
pub addressbyteshash_to_outputtypeindex: Store<AddressBytesHash, OutputTypeIndex>,
pub addressbyteshash_to_typeindex: Store<AddressBytesHash, TypeIndex>,
pub blockhashprefix_to_height: Store<BlockHashPrefix, Height>,
pub txidprefix_to_txindex: Store<TxidPrefix, TxIndex>,
}
@@ -35,11 +35,11 @@ impl Stores {
};
thread::scope(|scope| {
let addressbyteshash_to_outputtypeindex = scope.spawn(|| {
let addressbyteshash_to_typeindex = scope.spawn(|| {
Store::import(
&keyspace,
path,
"addressbyteshash_to_outputtypeindex",
"addressbyteshash_to_typeindex",
version + VERSION + Version::ZERO,
None,
)
@@ -65,9 +65,7 @@ impl Stores {
Ok(Self {
keyspace: keyspace.clone(),
addressbyteshash_to_outputtypeindex: addressbyteshash_to_outputtypeindex
.join()
.unwrap()?,
addressbyteshash_to_typeindex: addressbyteshash_to_typeindex.join().unwrap()?,
blockhashprefix_to_height: blockhashprefix_to_height.join().unwrap()?,
txidprefix_to_txindex: txidprefix_to_txindex.join().unwrap()?,
})
@@ -79,7 +77,7 @@ impl Stores {
vecs: &mut Vecs,
starting_indexes: &Indexes,
) -> color_eyre::Result<()> {
if self.addressbyteshash_to_outputtypeindex.is_empty()
if self.addressbyteshash_to_typeindex.is_empty()
&& self.blockhashprefix_to_height.is_empty()
&& self.txidprefix_to_txindex.is_empty()
{
@@ -95,158 +93,166 @@ impl Stores {
});
if let Some(mut index) = vecs
.height_to_first_p2pk65index
.height_to_first_p2pk65addressindex
.iter()
.get(starting_indexes.height)
.map(Value::into_inner)
{
let mut p2pk65index_to_p2pk65bytes_iter = vecs.p2pk65index_to_p2pk65bytes.iter();
let mut p2pk65addressindex_to_p2pk65bytes_iter =
vecs.p2pk65addressindex_to_p2pk65bytes.iter();
while let Some(typedbytes) = p2pk65index_to_p2pk65bytes_iter
while let Some(typedbytes) = p2pk65addressindex_to_p2pk65bytes_iter
.get(index)
.map(Value::into_inner)
{
let bytes = AddressBytes::from(typedbytes);
let hash = AddressBytesHash::from((&bytes, OutputType::P2PK65));
self.addressbyteshash_to_outputtypeindex.remove(hash);
self.addressbyteshash_to_typeindex.remove(hash);
index.increment();
}
}
if let Some(mut index) = vecs
.height_to_first_p2pk33index
.height_to_first_p2pk33addressindex
.iter()
.get(starting_indexes.height)
.map(Value::into_inner)
{
let mut p2pk33index_to_p2pk33bytes_iter = vecs.p2pk33index_to_p2pk33bytes.iter();
let mut p2pk33addressindex_to_p2pk33bytes_iter =
vecs.p2pk33addressindex_to_p2pk33bytes.iter();
while let Some(typedbytes) = p2pk33index_to_p2pk33bytes_iter
while let Some(typedbytes) = p2pk33addressindex_to_p2pk33bytes_iter
.get(index)
.map(Value::into_inner)
{
let bytes = AddressBytes::from(typedbytes);
let hash = AddressBytesHash::from((&bytes, OutputType::P2PK33));
self.addressbyteshash_to_outputtypeindex.remove(hash);
self.addressbyteshash_to_typeindex.remove(hash);
index.increment();
}
}
if let Some(mut index) = vecs
.height_to_first_p2pkhindex
.height_to_first_p2pkhaddressindex
.iter()
.get(starting_indexes.height)
.map(Value::into_inner)
{
let mut p2pkhindex_to_p2pkhbytes_iter = vecs.p2pkhindex_to_p2pkhbytes.iter();
let mut p2pkhaddressindex_to_p2pkhbytes_iter =
vecs.p2pkhaddressindex_to_p2pkhbytes.iter();
while let Some(typedbytes) = p2pkhindex_to_p2pkhbytes_iter
while let Some(typedbytes) = p2pkhaddressindex_to_p2pkhbytes_iter
.get(index)
.map(Value::into_inner)
{
let bytes = AddressBytes::from(typedbytes);
let hash = AddressBytesHash::from((&bytes, OutputType::P2PKH));
self.addressbyteshash_to_outputtypeindex.remove(hash);
self.addressbyteshash_to_typeindex.remove(hash);
index.increment();
}
}
if let Some(mut index) = vecs
.height_to_first_p2shindex
.height_to_first_p2shaddressindex
.iter()
.get(starting_indexes.height)
.map(Value::into_inner)
{
let mut p2shindex_to_p2shbytes_iter = vecs.p2shindex_to_p2shbytes.iter();
let mut p2shaddressindex_to_p2shbytes_iter =
vecs.p2shaddressindex_to_p2shbytes.iter();
while let Some(typedbytes) = p2shindex_to_p2shbytes_iter
while let Some(typedbytes) = p2shaddressindex_to_p2shbytes_iter
.get(index)
.map(Value::into_inner)
{
let bytes = AddressBytes::from(typedbytes);
let hash = AddressBytesHash::from((&bytes, OutputType::P2SH));
self.addressbyteshash_to_outputtypeindex.remove(hash);
self.addressbyteshash_to_typeindex.remove(hash);
index.increment();
}
}
if let Some(mut index) = vecs
.height_to_first_p2trindex
.height_to_first_p2traddressindex
.iter()
.get(starting_indexes.height)
.map(Value::into_inner)
{
let mut p2trindex_to_p2trbytes_iter = vecs.p2trindex_to_p2trbytes.iter();
let mut p2traddressindex_to_p2trbytes_iter =
vecs.p2traddressindex_to_p2trbytes.iter();
while let Some(typedbytes) = p2trindex_to_p2trbytes_iter
while let Some(typedbytes) = p2traddressindex_to_p2trbytes_iter
.get(index)
.map(Value::into_inner)
{
let bytes = AddressBytes::from(typedbytes);
let hash = AddressBytesHash::from((&bytes, OutputType::P2TR));
self.addressbyteshash_to_outputtypeindex.remove(hash);
self.addressbyteshash_to_typeindex.remove(hash);
index.increment();
}
}
if let Some(mut index) = vecs
.height_to_first_p2wpkhindex
.height_to_first_p2wpkhaddressindex
.iter()
.get(starting_indexes.height)
.map(Value::into_inner)
{
let mut p2wpkhindex_to_p2wpkhbytes_iter = vecs.p2wpkhindex_to_p2wpkhbytes.iter();
let mut p2wpkhaddressindex_to_p2wpkhbytes_iter =
vecs.p2wpkhaddressindex_to_p2wpkhbytes.iter();
while let Some(typedbytes) = p2wpkhindex_to_p2wpkhbytes_iter
while let Some(typedbytes) = p2wpkhaddressindex_to_p2wpkhbytes_iter
.get(index)
.map(Value::into_inner)
{
let bytes = AddressBytes::from(typedbytes);
let hash = AddressBytesHash::from((&bytes, OutputType::P2WPKH));
self.addressbyteshash_to_outputtypeindex.remove(hash);
self.addressbyteshash_to_typeindex.remove(hash);
index.increment();
}
}
if let Some(mut index) = vecs
.height_to_first_p2wshindex
.height_to_first_p2wshaddressindex
.iter()
.get(starting_indexes.height)
.map(Value::into_inner)
{
let mut p2wshindex_to_p2wshbytes_iter = vecs.p2wshindex_to_p2wshbytes.iter();
let mut p2wshaddressindex_to_p2wshbytes_iter =
vecs.p2wshaddressindex_to_p2wshbytes.iter();
while let Some(typedbytes) = p2wshindex_to_p2wshbytes_iter
while let Some(typedbytes) = p2wshaddressindex_to_p2wshbytes_iter
.get(index)
.map(Value::into_inner)
{
let bytes = AddressBytes::from(typedbytes);
let hash = AddressBytesHash::from((&bytes, OutputType::P2WSH));
self.addressbyteshash_to_outputtypeindex.remove(hash);
self.addressbyteshash_to_typeindex.remove(hash);
index.increment();
}
}
if let Some(mut index) = vecs
.height_to_first_p2aindex
.height_to_first_p2aaddressindex
.iter()
.get(starting_indexes.height)
.map(Value::into_inner)
{
let mut p2aindex_to_p2abytes_iter = vecs.p2aindex_to_p2abytes.iter();
let mut p2aaddressindex_to_p2abytes_iter = vecs.p2aaddressindex_to_p2abytes.iter();
while let Some(typedbytes) =
p2aindex_to_p2abytes_iter.get(index).map(Value::into_inner)
while let Some(typedbytes) = p2aaddressindex_to_p2abytes_iter
.get(index)
.map(Value::into_inner)
{
let bytes = AddressBytes::from(typedbytes);
let hash = AddressBytesHash::from((&bytes, OutputType::P2A));
self.addressbyteshash_to_outputtypeindex.remove(hash);
self.addressbyteshash_to_typeindex.remove(hash);
index.increment();
}
}
} else {
self.blockhashprefix_to_height.reset_partition()?;
self.addressbyteshash_to_outputtypeindex.reset_partition()?;
self.addressbyteshash_to_typeindex.reset_partition()?;
}
if starting_indexes.txindex != TxIndex::ZERO {
@@ -278,7 +284,7 @@ impl Stores {
pub fn starting_height(&self) -> Height {
[
self.addressbyteshash_to_outputtypeindex.height(),
self.addressbyteshash_to_typeindex.height(),
self.blockhashprefix_to_height.height(),
self.txidprefix_to_txindex.height(),
]
@@ -290,14 +296,14 @@ impl Stores {
pub fn commit(&mut self, height: Height) -> Result<()> {
thread::scope(|scope| -> Result<()> {
let addressbyteshash_to_outputtypeindex_commit_handle =
scope.spawn(|| self.addressbyteshash_to_outputtypeindex.commit(height));
let addressbyteshash_to_typeindex_commit_handle =
scope.spawn(|| self.addressbyteshash_to_typeindex.commit(height));
let blockhashprefix_to_height_commit_handle =
scope.spawn(|| self.blockhashprefix_to_height.commit(height));
let txidprefix_to_txindex_commit_handle =
scope.spawn(|| self.txidprefix_to_txindex.commit(height));
addressbyteshash_to_outputtypeindex_commit_handle
addressbyteshash_to_typeindex_commit_handle
.join()
.unwrap()?;
blockhashprefix_to_height_commit_handle.join().unwrap()?;
@@ -312,7 +318,7 @@ impl Stores {
}
pub fn rotate_memtables(&self) {
self.addressbyteshash_to_outputtypeindex.rotate_memtable();
self.addressbyteshash_to_typeindex.rotate_memtable();
self.blockhashprefix_to_height.rotate_memtable();
self.txidprefix_to_txindex.rotate_memtable();
}

View File

@@ -2,11 +2,11 @@ use std::path::Path;
use brk_core::{
AddressBytes, BlockHash, EmptyOutputIndex, Height, InputIndex, OpReturnIndex, OutputIndex,
OutputType, OutputTypeIndex, P2ABytes, P2AIndex, P2MSIndex, P2PK33Bytes, P2PK33Index,
P2PK65Bytes, P2PK65Index, P2PKHBytes, P2PKHIndex, P2SHBytes, P2SHIndex, P2TRBytes, P2TRIndex,
P2WPKHBytes, P2WPKHIndex, P2WSHBytes, P2WSHIndex, RawLockTime, Result, Sats, StoredF64,
StoredU32, StoredUsize, Timestamp, TxIndex, TxVersion, Txid, UnknownOutputIndex, Version,
Weight,
OutputType, P2AAddressIndex, P2ABytes, P2MSOutputIndex, P2PK33AddressIndex, P2PK33Bytes,
P2PK65AddressIndex, P2PK65Bytes, P2PKHAddressIndex, P2PKHBytes, P2SHAddressIndex, P2SHBytes,
P2TRAddressIndex, P2TRBytes, P2WPKHAddressIndex, P2WPKHBytes, P2WSHAddressIndex, P2WSHBytes,
RawLockTime, Result, Sats, StoredF64, StoredU32, StoredUsize, Timestamp, TxIndex, TxVersion,
Txid, TypeIndex, UnknownOutputIndex, Version, Weight,
};
use brk_vec::{AnyCollectableVec, AnyIndexedVec, Format, IndexedVec};
use rayon::prelude::*;
@@ -24,15 +24,15 @@ pub struct Vecs {
pub height_to_first_inputindex: IndexedVec<Height, InputIndex>,
pub height_to_first_opreturnindex: IndexedVec<Height, OpReturnIndex>,
pub height_to_first_outputindex: IndexedVec<Height, OutputIndex>,
pub height_to_first_p2aindex: IndexedVec<Height, P2AIndex>,
pub height_to_first_p2msindex: IndexedVec<Height, P2MSIndex>,
pub height_to_first_p2pk33index: IndexedVec<Height, P2PK33Index>,
pub height_to_first_p2pk65index: IndexedVec<Height, P2PK65Index>,
pub height_to_first_p2pkhindex: IndexedVec<Height, P2PKHIndex>,
pub height_to_first_p2shindex: IndexedVec<Height, P2SHIndex>,
pub height_to_first_p2trindex: IndexedVec<Height, P2TRIndex>,
pub height_to_first_p2wpkhindex: IndexedVec<Height, P2WPKHIndex>,
pub height_to_first_p2wshindex: IndexedVec<Height, P2WSHIndex>,
pub height_to_first_p2aaddressindex: IndexedVec<Height, P2AAddressIndex>,
pub height_to_first_p2msoutputindex: IndexedVec<Height, P2MSOutputIndex>,
pub height_to_first_p2pk33addressindex: IndexedVec<Height, P2PK33AddressIndex>,
pub height_to_first_p2pk65addressindex: IndexedVec<Height, P2PK65AddressIndex>,
pub height_to_first_p2pkhaddressindex: IndexedVec<Height, P2PKHAddressIndex>,
pub height_to_first_p2shaddressindex: IndexedVec<Height, P2SHAddressIndex>,
pub height_to_first_p2traddressindex: IndexedVec<Height, P2TRAddressIndex>,
pub height_to_first_p2wpkhaddressindex: IndexedVec<Height, P2WPKHAddressIndex>,
pub height_to_first_p2wshaddressindex: IndexedVec<Height, P2WSHAddressIndex>,
pub height_to_first_txindex: IndexedVec<Height, TxIndex>,
pub height_to_first_unknownoutputindex: IndexedVec<Height, UnknownOutputIndex>,
/// Doesn't guarantee continuity due to possible reorgs
@@ -43,17 +43,17 @@ pub struct Vecs {
pub inputindex_to_outputindex: IndexedVec<InputIndex, OutputIndex>,
pub opreturnindex_to_txindex: IndexedVec<OpReturnIndex, TxIndex>,
pub outputindex_to_outputtype: IndexedVec<OutputIndex, OutputType>,
pub outputindex_to_outputtypeindex: IndexedVec<OutputIndex, OutputTypeIndex>,
pub outputindex_to_typeindex: IndexedVec<OutputIndex, TypeIndex>,
pub outputindex_to_value: IndexedVec<OutputIndex, Sats>,
pub p2aindex_to_p2abytes: IndexedVec<P2AIndex, P2ABytes>,
pub p2msindex_to_txindex: IndexedVec<P2MSIndex, TxIndex>,
pub p2pk33index_to_p2pk33bytes: IndexedVec<P2PK33Index, P2PK33Bytes>,
pub p2pk65index_to_p2pk65bytes: IndexedVec<P2PK65Index, P2PK65Bytes>,
pub p2pkhindex_to_p2pkhbytes: IndexedVec<P2PKHIndex, P2PKHBytes>,
pub p2shindex_to_p2shbytes: IndexedVec<P2SHIndex, P2SHBytes>,
pub p2trindex_to_p2trbytes: IndexedVec<P2TRIndex, P2TRBytes>,
pub p2wpkhindex_to_p2wpkhbytes: IndexedVec<P2WPKHIndex, P2WPKHBytes>,
pub p2wshindex_to_p2wshbytes: IndexedVec<P2WSHIndex, P2WSHBytes>,
pub p2aaddressindex_to_p2abytes: IndexedVec<P2AAddressIndex, P2ABytes>,
pub p2msoutputindex_to_txindex: IndexedVec<P2MSOutputIndex, TxIndex>,
pub p2pk33addressindex_to_p2pk33bytes: IndexedVec<P2PK33AddressIndex, P2PK33Bytes>,
pub p2pk65addressindex_to_p2pk65bytes: IndexedVec<P2PK65AddressIndex, P2PK65Bytes>,
pub p2pkhaddressindex_to_p2pkhbytes: IndexedVec<P2PKHAddressIndex, P2PKHBytes>,
pub p2shaddressindex_to_p2shbytes: IndexedVec<P2SHAddressIndex, P2SHBytes>,
pub p2traddressindex_to_p2trbytes: IndexedVec<P2TRAddressIndex, P2TRBytes>,
pub p2wpkhaddressindex_to_p2wpkhbytes: IndexedVec<P2WPKHAddressIndex, P2WPKHBytes>,
pub p2wshaddressindex_to_p2wshbytes: IndexedVec<P2WSHAddressIndex, P2WSHBytes>,
pub txindex_to_base_size: IndexedVec<TxIndex, StoredU32>,
pub txindex_to_first_inputindex: IndexedVec<TxIndex, InputIndex>,
pub txindex_to_first_outputindex: IndexedVec<TxIndex, OutputIndex>,
@@ -110,57 +110,57 @@ impl Vecs {
version + VERSION + Version::ZERO,
Format::Raw,
)?,
height_to_first_p2aindex: IndexedVec::forced_import(
height_to_first_p2aaddressindex: IndexedVec::forced_import(
path,
"first_p2aindex",
"first_p2aaddressindex",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
height_to_first_p2msindex: IndexedVec::forced_import(
height_to_first_p2msoutputindex: IndexedVec::forced_import(
path,
"first_p2msindex",
"first_p2msoutputindex",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
height_to_first_p2pk33index: IndexedVec::forced_import(
height_to_first_p2pk33addressindex: IndexedVec::forced_import(
path,
"first_p2pk33index",
"first_p2pk33addressindex",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
height_to_first_p2pk65index: IndexedVec::forced_import(
height_to_first_p2pk65addressindex: IndexedVec::forced_import(
path,
"first_p2pk65index",
"first_p2pk65addressindex",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
height_to_first_p2pkhindex: IndexedVec::forced_import(
height_to_first_p2pkhaddressindex: IndexedVec::forced_import(
path,
"first_p2pkhindex",
"first_p2pkhaddressindex",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
height_to_first_p2shindex: IndexedVec::forced_import(
height_to_first_p2shaddressindex: IndexedVec::forced_import(
path,
"first_p2shindex",
"first_p2shaddressindex",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
height_to_first_p2trindex: IndexedVec::forced_import(
height_to_first_p2traddressindex: IndexedVec::forced_import(
path,
"first_p2trindex",
"first_p2traddressindex",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
height_to_first_p2wpkhindex: IndexedVec::forced_import(
height_to_first_p2wpkhaddressindex: IndexedVec::forced_import(
path,
"first_p2wpkhindex",
"first_p2wpkhaddressindex",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
height_to_first_p2wshindex: IndexedVec::forced_import(
height_to_first_p2wshaddressindex: IndexedVec::forced_import(
path,
"first_p2wshindex",
"first_p2wshaddressindex",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
@@ -212,9 +212,9 @@ impl Vecs {
version + VERSION + Version::ZERO,
Format::Raw,
)?,
outputindex_to_outputtypeindex: IndexedVec::forced_import(
outputindex_to_typeindex: IndexedVec::forced_import(
path,
"outputtypeindex",
"typeindex",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
@@ -224,55 +224,55 @@ impl Vecs {
version + VERSION + Version::ZERO,
Format::Raw,
)?,
p2aindex_to_p2abytes: IndexedVec::forced_import(
p2aaddressindex_to_p2abytes: IndexedVec::forced_import(
path,
"p2abytes",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
p2msindex_to_txindex: IndexedVec::forced_import(
p2msoutputindex_to_txindex: IndexedVec::forced_import(
path,
"txindex",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
p2pk33index_to_p2pk33bytes: IndexedVec::forced_import(
p2pk33addressindex_to_p2pk33bytes: IndexedVec::forced_import(
path,
"p2pk33bytes",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
p2pk65index_to_p2pk65bytes: IndexedVec::forced_import(
p2pk65addressindex_to_p2pk65bytes: IndexedVec::forced_import(
path,
"p2pk65bytes",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
p2pkhindex_to_p2pkhbytes: IndexedVec::forced_import(
p2pkhaddressindex_to_p2pkhbytes: IndexedVec::forced_import(
path,
"p2pkhbytes",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
p2shindex_to_p2shbytes: IndexedVec::forced_import(
p2shaddressindex_to_p2shbytes: IndexedVec::forced_import(
path,
"p2shbytes",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
p2trindex_to_p2trbytes: IndexedVec::forced_import(
p2traddressindex_to_p2trbytes: IndexedVec::forced_import(
path,
"p2trbytes",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
p2wpkhindex_to_p2wpkhbytes: IndexedVec::forced_import(
p2wpkhaddressindex_to_p2wpkhbytes: IndexedVec::forced_import(
path,
"p2wpkhbytes",
version + VERSION + Version::ZERO,
Format::Raw,
)?,
p2wshindex_to_p2wshbytes: IndexedVec::forced_import(
p2wshaddressindex_to_p2wshbytes: IndexedVec::forced_import(
path,
"p2wshbytes",
version + VERSION + Version::ZERO,
@@ -344,15 +344,15 @@ impl Vecs {
inputindex,
opreturnindex,
outputindex,
p2aindex,
p2msindex,
p2pk33index,
p2pk65index,
p2pkhindex,
p2shindex,
p2trindex,
p2wpkhindex,
p2wshindex,
p2aaddressindex,
p2msoutputindex,
p2pk33addressindex,
p2pk65addressindex,
p2pkhaddressindex,
p2shaddressindex,
p2traddressindex,
p2wpkhaddressindex,
p2wshaddressindex,
txindex,
unknownoutputindex,
} = starting_indexes;
@@ -371,23 +371,23 @@ impl Vecs {
.truncate_if_needed(height, saved_height)?;
self.height_to_first_outputindex
.truncate_if_needed(height, saved_height)?;
self.height_to_first_p2aindex
self.height_to_first_p2aaddressindex
.truncate_if_needed(height, saved_height)?;
self.height_to_first_p2msindex
self.height_to_first_p2msoutputindex
.truncate_if_needed(height, saved_height)?;
self.height_to_first_p2pk33index
self.height_to_first_p2pk33addressindex
.truncate_if_needed(height, saved_height)?;
self.height_to_first_p2pk65index
self.height_to_first_p2pk65addressindex
.truncate_if_needed(height, saved_height)?;
self.height_to_first_p2pkhindex
self.height_to_first_p2pkhaddressindex
.truncate_if_needed(height, saved_height)?;
self.height_to_first_p2shindex
self.height_to_first_p2shaddressindex
.truncate_if_needed(height, saved_height)?;
self.height_to_first_p2trindex
self.height_to_first_p2traddressindex
.truncate_if_needed(height, saved_height)?;
self.height_to_first_p2wpkhindex
self.height_to_first_p2wpkhaddressindex
.truncate_if_needed(height, saved_height)?;
self.height_to_first_p2wshindex
self.height_to_first_p2wshaddressindex
.truncate_if_needed(height, saved_height)?;
self.height_to_first_txindex
.truncate_if_needed(height, saved_height)?;
@@ -405,28 +405,28 @@ impl Vecs {
.truncate_if_needed(opreturnindex, saved_height)?;
self.outputindex_to_outputtype
.truncate_if_needed(outputindex, saved_height)?;
self.outputindex_to_outputtypeindex
self.outputindex_to_typeindex
.truncate_if_needed(outputindex, saved_height)?;
self.outputindex_to_value
.truncate_if_needed(outputindex, saved_height)?;
self.p2aindex_to_p2abytes
.truncate_if_needed(p2aindex, saved_height)?;
self.p2msindex_to_txindex
.truncate_if_needed(p2msindex, saved_height)?;
self.p2pk33index_to_p2pk33bytes
.truncate_if_needed(p2pk33index, saved_height)?;
self.p2pk65index_to_p2pk65bytes
.truncate_if_needed(p2pk65index, saved_height)?;
self.p2pkhindex_to_p2pkhbytes
.truncate_if_needed(p2pkhindex, saved_height)?;
self.p2shindex_to_p2shbytes
.truncate_if_needed(p2shindex, saved_height)?;
self.p2trindex_to_p2trbytes
.truncate_if_needed(p2trindex, saved_height)?;
self.p2wpkhindex_to_p2wpkhbytes
.truncate_if_needed(p2wpkhindex, saved_height)?;
self.p2wshindex_to_p2wshbytes
.truncate_if_needed(p2wshindex, saved_height)?;
self.p2aaddressindex_to_p2abytes
.truncate_if_needed(p2aaddressindex, saved_height)?;
self.p2msoutputindex_to_txindex
.truncate_if_needed(p2msoutputindex, saved_height)?;
self.p2pk33addressindex_to_p2pk33bytes
.truncate_if_needed(p2pk33addressindex, saved_height)?;
self.p2pk65addressindex_to_p2pk65bytes
.truncate_if_needed(p2pk65addressindex, saved_height)?;
self.p2pkhaddressindex_to_p2pkhbytes
.truncate_if_needed(p2pkhaddressindex, saved_height)?;
self.p2shaddressindex_to_p2shbytes
.truncate_if_needed(p2shaddressindex, saved_height)?;
self.p2traddressindex_to_p2trbytes
.truncate_if_needed(p2traddressindex, saved_height)?;
self.p2wpkhaddressindex_to_p2wpkhbytes
.truncate_if_needed(p2wpkhaddressindex, saved_height)?;
self.p2wshaddressindex_to_p2wshbytes
.truncate_if_needed(p2wshaddressindex, saved_height)?;
self.txindex_to_base_size
.truncate_if_needed(txindex, saved_height)?;
self.txindex_to_first_inputindex
@@ -449,35 +449,31 @@ impl Vecs {
Ok(())
}
pub fn push_bytes_if_needed(
&mut self,
index: OutputTypeIndex,
bytes: AddressBytes,
) -> Result<()> {
pub fn push_bytes_if_needed(&mut self, index: TypeIndex, bytes: AddressBytes) -> Result<()> {
match bytes {
AddressBytes::P2PK65(bytes) => self
.p2pk65index_to_p2pk65bytes
.p2pk65addressindex_to_p2pk65bytes
.push_if_needed(index.into(), bytes),
AddressBytes::P2PK33(bytes) => self
.p2pk33index_to_p2pk33bytes
.p2pk33addressindex_to_p2pk33bytes
.push_if_needed(index.into(), bytes),
AddressBytes::P2PKH(bytes) => self
.p2pkhindex_to_p2pkhbytes
.p2pkhaddressindex_to_p2pkhbytes
.push_if_needed(index.into(), bytes),
AddressBytes::P2SH(bytes) => self
.p2shindex_to_p2shbytes
.p2shaddressindex_to_p2shbytes
.push_if_needed(index.into(), bytes),
AddressBytes::P2WPKH(bytes) => self
.p2wpkhindex_to_p2wpkhbytes
.p2wpkhaddressindex_to_p2wpkhbytes
.push_if_needed(index.into(), bytes),
AddressBytes::P2WSH(bytes) => self
.p2wshindex_to_p2wshbytes
.p2wshaddressindex_to_p2wshbytes
.push_if_needed(index.into(), bytes),
AddressBytes::P2TR(bytes) => self
.p2trindex_to_p2trbytes
.p2traddressindex_to_p2trbytes
.push_if_needed(index.into(), bytes),
AddressBytes::P2A(bytes) => self
.p2aindex_to_p2abytes
.p2aaddressindex_to_p2abytes
.push_if_needed(index.into(), bytes),
}
}
@@ -508,15 +504,15 @@ impl Vecs {
&self.height_to_first_inputindex,
&self.height_to_first_opreturnindex,
&self.height_to_first_outputindex,
&self.height_to_first_p2aindex,
&self.height_to_first_p2msindex,
&self.height_to_first_p2pk33index,
&self.height_to_first_p2pk65index,
&self.height_to_first_p2pkhindex,
&self.height_to_first_p2shindex,
&self.height_to_first_p2trindex,
&self.height_to_first_p2wpkhindex,
&self.height_to_first_p2wshindex,
&self.height_to_first_p2aaddressindex,
&self.height_to_first_p2msoutputindex,
&self.height_to_first_p2pk33addressindex,
&self.height_to_first_p2pk65addressindex,
&self.height_to_first_p2pkhaddressindex,
&self.height_to_first_p2shaddressindex,
&self.height_to_first_p2traddressindex,
&self.height_to_first_p2wpkhaddressindex,
&self.height_to_first_p2wshaddressindex,
&self.height_to_first_txindex,
&self.height_to_first_unknownoutputindex,
&self.height_to_timestamp,
@@ -525,17 +521,17 @@ impl Vecs {
&self.inputindex_to_outputindex,
&self.opreturnindex_to_txindex,
&self.outputindex_to_outputtype,
&self.outputindex_to_outputtypeindex,
&self.outputindex_to_typeindex,
&self.outputindex_to_value,
&self.p2aindex_to_p2abytes,
&self.p2msindex_to_txindex,
&self.p2pk33index_to_p2pk33bytes,
&self.p2pk65index_to_p2pk65bytes,
&self.p2pkhindex_to_p2pkhbytes,
&self.p2shindex_to_p2shbytes,
&self.p2trindex_to_p2trbytes,
&self.p2wpkhindex_to_p2wpkhbytes,
&self.p2wshindex_to_p2wshbytes,
&self.p2aaddressindex_to_p2abytes,
&self.p2msoutputindex_to_txindex,
&self.p2pk33addressindex_to_p2pk33bytes,
&self.p2pk65addressindex_to_p2pk65bytes,
&self.p2pkhaddressindex_to_p2pkhbytes,
&self.p2shaddressindex_to_p2shbytes,
&self.p2traddressindex_to_p2trbytes,
&self.p2wpkhaddressindex_to_p2wpkhbytes,
&self.p2wshaddressindex_to_p2wshbytes,
&self.txindex_to_base_size,
&self.txindex_to_first_inputindex,
&self.txindex_to_first_outputindex,
@@ -557,15 +553,15 @@ impl Vecs {
&mut self.height_to_first_inputindex,
&mut self.height_to_first_opreturnindex,
&mut self.height_to_first_outputindex,
&mut self.height_to_first_p2aindex,
&mut self.height_to_first_p2msindex,
&mut self.height_to_first_p2pk33index,
&mut self.height_to_first_p2pk65index,
&mut self.height_to_first_p2pkhindex,
&mut self.height_to_first_p2shindex,
&mut self.height_to_first_p2trindex,
&mut self.height_to_first_p2wpkhindex,
&mut self.height_to_first_p2wshindex,
&mut self.height_to_first_p2aaddressindex,
&mut self.height_to_first_p2msoutputindex,
&mut self.height_to_first_p2pk33addressindex,
&mut self.height_to_first_p2pk65addressindex,
&mut self.height_to_first_p2pkhaddressindex,
&mut self.height_to_first_p2shaddressindex,
&mut self.height_to_first_p2traddressindex,
&mut self.height_to_first_p2wpkhaddressindex,
&mut self.height_to_first_p2wshaddressindex,
&mut self.height_to_first_txindex,
&mut self.height_to_first_unknownoutputindex,
&mut self.height_to_timestamp,
@@ -574,17 +570,17 @@ impl Vecs {
&mut self.inputindex_to_outputindex,
&mut self.opreturnindex_to_txindex,
&mut self.outputindex_to_outputtype,
&mut self.outputindex_to_outputtypeindex,
&mut self.outputindex_to_typeindex,
&mut self.outputindex_to_value,
&mut self.p2aindex_to_p2abytes,
&mut self.p2msindex_to_txindex,
&mut self.p2pk33index_to_p2pk33bytes,
&mut self.p2pk65index_to_p2pk65bytes,
&mut self.p2pkhindex_to_p2pkhbytes,
&mut self.p2shindex_to_p2shbytes,
&mut self.p2trindex_to_p2trbytes,
&mut self.p2wpkhindex_to_p2wpkhbytes,
&mut self.p2wshindex_to_p2wshbytes,
&mut self.p2aaddressindex_to_p2abytes,
&mut self.p2msoutputindex_to_txindex,
&mut self.p2pk33addressindex_to_p2pk33bytes,
&mut self.p2pk65addressindex_to_p2pk65bytes,
&mut self.p2pkhaddressindex_to_p2pkhbytes,
&mut self.p2shaddressindex_to_p2shbytes,
&mut self.p2traddressindex_to_p2trbytes,
&mut self.p2wpkhaddressindex_to_p2wpkhbytes,
&mut self.p2wshaddressindex_to_p2wshbytes,
&mut self.txindex_to_base_size,
&mut self.txindex_to_first_inputindex,
&mut self.txindex_to_first_outputindex,

View File

@@ -2,9 +2,9 @@ use std::fmt::{self, Debug};
use brk_core::{
DateIndex, DecadeIndex, DifficultyEpoch, EmptyOutputIndex, HalvingEpoch, Height, InputIndex,
MonthIndex, OpReturnIndex, OutputIndex, P2AIndex, P2MSIndex, P2PK33Index, P2PK65Index,
P2PKHIndex, P2SHIndex, P2TRIndex, P2WPKHIndex, P2WSHIndex, Printable, QuarterIndex, TxIndex,
UnknownOutputIndex, WeekIndex, YearIndex,
MonthIndex, OpReturnIndex, OutputIndex, P2AAddressIndex, P2MSOutputIndex, P2PK33AddressIndex,
P2PK65AddressIndex, P2PKHAddressIndex, P2SHAddressIndex, P2TRAddressIndex, P2WPKHAddressIndex,
P2WSHAddressIndex, Printable, QuarterIndex, TxIndex, UnknownOutputIndex, WeekIndex, YearIndex,
};
use color_eyre::eyre::eyre;
use schemars::JsonSchema;
@@ -22,15 +22,15 @@ pub enum Index {
MonthIndex,
OpReturnIndex,
OutputIndex,
P2AIndex,
P2MSIndex,
P2PK33Index,
P2PK65Index,
P2PKHIndex,
P2SHIndex,
P2TRIndex,
P2WPKHIndex,
P2WSHIndex,
P2AAddressIndex,
P2MSOutputIndex,
P2PK33AddressIndex,
P2PK65AddressIndex,
P2PKHAddressIndex,
P2SHAddressIndex,
P2TRAddressIndex,
P2WPKHAddressIndex,
P2WSHAddressIndex,
QuarterIndex,
TxIndex,
UnknownOutputIndex,
@@ -51,15 +51,15 @@ impl Index {
Self::MonthIndex,
Self::OpReturnIndex,
Self::OutputIndex,
Self::P2AIndex,
Self::P2MSIndex,
Self::P2PK33Index,
Self::P2PK65Index,
Self::P2PKHIndex,
Self::P2SHIndex,
Self::P2TRIndex,
Self::P2WPKHIndex,
Self::P2WSHIndex,
Self::P2AAddressIndex,
Self::P2MSOutputIndex,
Self::P2PK33AddressIndex,
Self::P2PK65AddressIndex,
Self::P2PKHAddressIndex,
Self::P2SHAddressIndex,
Self::P2TRAddressIndex,
Self::P2WPKHAddressIndex,
Self::P2WSHAddressIndex,
Self::QuarterIndex,
Self::TxIndex,
Self::UnknownOutputIndex,
@@ -80,15 +80,15 @@ impl Index {
Self::MonthIndex => MonthIndex::to_possible_strings(),
Self::OpReturnIndex => OpReturnIndex::to_possible_strings(),
Self::OutputIndex => OutputIndex::to_possible_strings(),
Self::P2AIndex => P2AIndex::to_possible_strings(),
Self::P2MSIndex => P2MSIndex::to_possible_strings(),
Self::P2PK33Index => P2PK33Index::to_possible_strings(),
Self::P2PK65Index => P2PK65Index::to_possible_strings(),
Self::P2PKHIndex => P2PKHIndex::to_possible_strings(),
Self::P2SHIndex => P2SHIndex::to_possible_strings(),
Self::P2TRIndex => P2TRIndex::to_possible_strings(),
Self::P2WPKHIndex => P2WPKHIndex::to_possible_strings(),
Self::P2WSHIndex => P2WSHIndex::to_possible_strings(),
Self::P2AAddressIndex => P2AAddressIndex::to_possible_strings(),
Self::P2MSOutputIndex => P2MSOutputIndex::to_possible_strings(),
Self::P2PK33AddressIndex => P2PK33AddressIndex::to_possible_strings(),
Self::P2PK65AddressIndex => P2PK65AddressIndex::to_possible_strings(),
Self::P2PKHAddressIndex => P2PKHAddressIndex::to_possible_strings(),
Self::P2SHAddressIndex => P2SHAddressIndex::to_possible_strings(),
Self::P2TRAddressIndex => P2TRAddressIndex::to_possible_strings(),
Self::P2WPKHAddressIndex => P2WPKHAddressIndex::to_possible_strings(),
Self::P2WSHAddressIndex => P2WSHAddressIndex::to_possible_strings(),
Self::QuarterIndex => QuarterIndex::to_possible_strings(),
Self::TxIndex => TxIndex::to_possible_strings(),
Self::UnknownOutputIndex => UnknownOutputIndex::to_possible_strings(),
@@ -130,15 +130,25 @@ impl TryFrom<&str> for Index {
v if (Self::MonthIndex).possible_values().contains(&v) => Self::MonthIndex,
v if (Self::OpReturnIndex).possible_values().contains(&v) => Self::OpReturnIndex,
v if (Self::OutputIndex).possible_values().contains(&v) => Self::OutputIndex,
v if (Self::P2AIndex).possible_values().contains(&v) => Self::P2AIndex,
v if (Self::P2MSIndex).possible_values().contains(&v) => Self::P2MSIndex,
v if (Self::P2PK33Index).possible_values().contains(&v) => Self::P2PK33Index,
v if (Self::P2PK65Index).possible_values().contains(&v) => Self::P2PK65Index,
v if (Self::P2PKHIndex).possible_values().contains(&v) => Self::P2PKHIndex,
v if (Self::P2SHIndex).possible_values().contains(&v) => Self::P2SHIndex,
v if (Self::P2TRIndex).possible_values().contains(&v) => Self::P2TRIndex,
v if (Self::P2WPKHIndex).possible_values().contains(&v) => Self::P2WPKHIndex,
v if (Self::P2WSHIndex).possible_values().contains(&v) => Self::P2WSHIndex,
v if (Self::P2AAddressIndex).possible_values().contains(&v) => Self::P2AAddressIndex,
v if (Self::P2MSOutputIndex).possible_values().contains(&v) => Self::P2MSOutputIndex,
v if (Self::P2PK33AddressIndex).possible_values().contains(&v) => {
Self::P2PK33AddressIndex
}
v if (Self::P2PK65AddressIndex).possible_values().contains(&v) => {
Self::P2PK65AddressIndex
}
v if (Self::P2PKHAddressIndex).possible_values().contains(&v) => {
Self::P2PKHAddressIndex
}
v if (Self::P2SHAddressIndex).possible_values().contains(&v) => Self::P2SHAddressIndex,
v if (Self::P2TRAddressIndex).possible_values().contains(&v) => Self::P2TRAddressIndex,
v if (Self::P2WPKHAddressIndex).possible_values().contains(&v) => {
Self::P2WPKHAddressIndex
}
v if (Self::P2WSHAddressIndex).possible_values().contains(&v) => {
Self::P2WSHAddressIndex
}
v if (Self::QuarterIndex).possible_values().contains(&v) => Self::QuarterIndex,
v if (Self::QuarterIndex).possible_values().contains(&v) => Self::QuarterIndex,
v if (Self::TxIndex).possible_values().contains(&v) => Self::TxIndex,

View File

@@ -3,6 +3,7 @@ use std::{fs, path::Path};
use brk_core::{DateIndex, Height, Version};
use brk_vec::{AnyVec, CollectableVec, Format, GenericStoredVec, StoredVec, VecIterator};
#[allow(clippy::upper_case_acronyms)]
type VEC = StoredVec<DateIndex, u32>;
fn main() -> Result<(), Box<dyn std::error::Error>> {

View File

@@ -42,14 +42,14 @@ where
version = version + VERSION;
let res = Self::import(parent, name, version);
match res {
// Err(Error::DifferentCompressionMode)
// | Err(Error::WrongEndian)
// | Err(Error::WrongLength)
// | Err(Error::DifferentVersion { .. }) => {
// let path = Self::path_(parent, name);
// fs::remove_file(path)?;
// Self::import(parent, name, version)
// }
Err(Error::DifferentCompressionMode)
| Err(Error::WrongEndian)
| Err(Error::WrongLength)
| Err(Error::DifferentVersion { .. }) => {
let path = Self::path_(parent, name);
fs::remove_file(path)?;
Self::import(parent, name, version)
}
_ => res,
}
}

View File

@@ -64,14 +64,14 @@ function initPackages() {
const imports = {
async signals() {
return import("../packages/solid-signals/wrapper.js").then(
(d) => d.default
(d) => d.default,
);
},
async lightweightCharts() {
return window.document.fonts.ready.then(() =>
import("../packages/lightweight-charts/wrapper.js").then(
(d) => d.default
)
(d) => d.default,
),
);
},
async leanQr() {
@@ -79,7 +79,7 @@ function initPackages() {
},
async ufuzzy() {
return import("../packages/ufuzzy/v1.0.18/script.js").then(
({ default: d }) => d
({ default: d }) => d,
);
},
};
@@ -587,7 +587,7 @@ function createUtils() {
window.history.pushState(
null,
"",
`${pathname}?${urlParams.toString()}`
`${pathname}?${urlParams.toString()}`,
);
} catch (_) {}
},
@@ -604,7 +604,7 @@ function createUtils() {
window.history.replaceState(
null,
"",
`${pathname}?${urlParams.toString()}`
`${pathname}?${urlParams.toString()}`,
);
} catch (_) {}
},
@@ -1138,23 +1138,23 @@ function createUtils() {
case /** @satisfies {OutputIndex} */ (9):
return "outputindex";
case /** @satisfies {P2AIndex} */ (10):
return "p2aindex";
return "p2aaddressindex";
case /** @satisfies {P2MSIndex} */ (11):
return "p2msindex";
return "p2msoutputindex";
case /** @satisfies {P2PK33Index} */ (12):
return "p2pk33index";
return "p2pk33addressindex";
case /** @satisfies {P2PK65Index} */ (13):
return "p2pk65index";
return "p2pk65addressindex";
case /** @satisfies {P2PKHIndex} */ (14):
return "p2pkhindex";
return "p2pkhaddressindex";
case /** @satisfies {P2SHIndex} */ (15):
return "p2shindex";
return "p2shaddressindex";
case /** @satisfies {P2TRIndex} */ (16):
return "p2trindex";
return "p2traddressindex";
case /** @satisfies {P2WPKHIndex} */ (17):
return "p2wpkhindex";
return "p2wpkhaddressindex";
case /** @satisfies {P2WSHIndex} */ (18):
return "p2wshindex";
return "p2wshaddressindex";
case /** @satisfies {QuarterIndex} */ (19):
return "quarterindex";
case /** @satisfies {TxIndex} */ (20):
@@ -1251,8 +1251,8 @@ function createUtils() {
today.getUTCDate(),
0,
0,
0
)
0,
),
);
},
/**
@@ -1339,7 +1339,7 @@ function createUtils() {
*/
function getNumberOfDaysBetweenTwoDates(oldest, youngest) {
return Math.round(
Math.abs((youngest.getTime() - oldest.getTime()) / date.ONE_DAY_IN_MS)
Math.abs((youngest.getTime() - oldest.getTime()) / date.ONE_DAY_IN_MS),
);
}
@@ -1558,7 +1558,7 @@ function createVecsResources(signals, utils) {
const fetchedRecord = signals.createSignal(
/** @type {Map<string, {loading: boolean, at: Date | null, vec: Signal<T[] | null>}>} */ (
new Map()
)
),
);
return {
@@ -1608,7 +1608,7 @@ function createVecsResources(signals, utils) {
index,
id,
from,
to
to,
)
);
fetched.at = new Date();
@@ -1869,7 +1869,7 @@ function initWebSockets(signals, utils) {
window.document.addEventListener(
"visibilitychange",
reinitWebSocketIfDocumentNotHidden
reinitWebSocketIfDocumentNotHidden,
);
window.document.addEventListener("online", reinitWebSocket);
@@ -1878,7 +1878,7 @@ function initWebSockets(signals, utils) {
ws?.close();
window.document.removeEventListener(
"visibilitychange",
reinitWebSocketIfDocumentNotHidden
reinitWebSocketIfDocumentNotHidden,
);
window.document.removeEventListener("online", reinitWebSocket);
live.set(false);
@@ -1904,7 +1904,7 @@ function initWebSockets(signals, utils) {
symbol: ["BTC/USD"],
interval: 1440,
},
})
}),
);
});
@@ -1933,7 +1933,7 @@ function initWebSockets(signals, utils) {
/** @type {ReturnType<typeof createWebsocket<CandlestickData>>} */
const kraken1dCandle = createWebsocket((callback) =>
krakenCandleWebSocketCreator(callback)
krakenCandleWebSocketCreator(callback),
);
kraken1dCandle.open();
@@ -1992,7 +1992,7 @@ function main() {
}
const frame = window.document.getElementById(
/** @type {string} */ (input.value)
/** @type {string} */ (input.value),
);
if (!frame) {
@@ -2090,23 +2090,23 @@ function main() {
function initDark() {
const preferredColorSchemeMatchMedia = window.matchMedia(
"(prefers-color-scheme: dark)"
"(prefers-color-scheme: dark)",
);
const dark = signals.createSignal(
preferredColorSchemeMatchMedia.matches
preferredColorSchemeMatchMedia.matches,
);
preferredColorSchemeMatchMedia.addEventListener(
"change",
({ matches }) => {
dark.set(matches);
}
},
);
return dark;
}
const dark = initDark();
const qrcode = signals.createSignal(
/** @type {string | null} */ (null)
/** @type {string | null} */ (null),
);
function createLastHeightResource() {
@@ -2117,7 +2117,7 @@ function main() {
lastHeight.set(h);
},
/** @satisfies {Height} */ (5),
"height"
"height",
);
}
fetchLastHeight();
@@ -2161,10 +2161,10 @@ function main() {
const owner = signals.getOwner();
const chartOption = signals.createSignal(
/** @type {ChartOption | null} */ (null)
/** @type {ChartOption | null} */ (null),
);
const simOption = signals.createSignal(
/** @type {SimulationOption | null} */ (null)
/** @type {SimulationOption | null} */ (null),
);
let previousElement = /** @type {HTMLElement | undefined} */ (
@@ -2210,9 +2210,9 @@ function main() {
webSockets,
vecsResources,
vecIdToIndexes,
})
)
)
}),
),
),
);
}
firstTimeLoadingChart = false;
@@ -2233,8 +2233,8 @@ function main() {
vecsResources,
option,
vecIdToIndexes,
})
)
}),
),
);
}
firstTimeLoadingTable = false;
@@ -2258,9 +2258,9 @@ function main() {
signals,
utils,
vecsResources,
})
)
)
}),
),
),
);
}
firstTimeLoadingSimulation = false;
@@ -2289,7 +2289,7 @@ function main() {
createMobileSwitchEffect();
utils.dom.onFirstIntersection(elements.aside, () =>
signals.runWithOwner(owner, initSelectedFrame)
signals.runWithOwner(owner, initSelectedFrame),
);
}
initSelected();
@@ -2369,7 +2369,7 @@ function main() {
if (indexes?.length) {
const maxIndex = Math.min(
(order || indexes).length - 1,
minIndex + RESULTS_PER_PAGE - 1
minIndex + RESULTS_PER_PAGE - 1,
);
list = Array(maxIndex - minIndex + 1);
@@ -2445,7 +2445,7 @@ function main() {
haystack,
needle,
undefined,
infoThresh
infoThresh,
);
if (!result?.[0]?.length || !result?.[1]) {
@@ -2453,7 +2453,7 @@ function main() {
haystack,
needle,
outOfOrder,
infoThresh
infoThresh,
);
}
@@ -2462,7 +2462,7 @@ function main() {
haystack,
needle,
outOfOrder,
infoThresh
infoThresh,
);
}
@@ -2471,7 +2471,7 @@ function main() {
haystack,
needle,
outOfOrder,
infoThresh
infoThresh,
);
}
@@ -2480,7 +2480,7 @@ function main() {
haystack,
needle,
undefined,
infoThresh
infoThresh,
);
}
@@ -2489,7 +2489,7 @@ function main() {
haystack,
needle,
outOfOrder,
infoThresh
infoThresh,
);
}
@@ -2572,7 +2572,7 @@ function main() {
shareDiv.hidden = false;
});
})
}),
);
}
initShare();
@@ -2596,7 +2596,7 @@ function main() {
utils.storage.write(barWidthLocalStorageKey, String(width));
} else {
elements.main.style.width = elements.style.getPropertyValue(
"--default-main-width"
"--default-main-width",
);
utils.storage.remove(barWidthLocalStorageKey);
}
@@ -2633,9 +2633,9 @@ function main() {
window.addEventListener("mouseleave", setResizeFalse);
}
initDesktopResizeBar();
})
)
)
}),
),
),
);
}
main();

View File

@@ -411,15 +411,15 @@ function createSerializedIndexes() {
/** @satisfies {VecId} */ ("monthindex"),
/** @satisfies {VecId} */ ("opreturnindex"),
/** @satisfies {VecId} */ ("outputindex"),
/** @satisfies {VecId} */ ("p2aindex"),
/** @satisfies {VecId} */ ("p2msindex"),
/** @satisfies {VecId} */ ("p2pk33index"),
/** @satisfies {VecId} */ ("p2pk65index"),
/** @satisfies {VecId} */ ("p2pkhindex"),
/** @satisfies {VecId} */ ("p2shindex"),
/** @satisfies {VecId} */ ("p2trindex"),
/** @satisfies {VecId} */ ("p2wpkhindex"),
/** @satisfies {VecId} */ ("p2wshindex"),
/** @satisfies {VecId} */ ("p2aaddressindex"),
/** @satisfies {VecId} */ ("p2msoutputindex"),
/** @satisfies {VecId} */ ("p2pk33addressindex"),
/** @satisfies {VecId} */ ("p2pk65addressindex"),
/** @satisfies {VecId} */ ("p2pkhaddressindex"),
/** @satisfies {VecId} */ ("p2shaddressindex"),
/** @satisfies {VecId} */ ("p2traddressindex"),
/** @satisfies {VecId} */ ("p2wpkhaddressindex"),
/** @satisfies {VecId} */ ("p2wshaddressindex"),
/** @satisfies {VecId} */ ("quarterindex"),
/** @satisfies {VecId} */ ("txindex"),
/** @satisfies {VecId} */ ("unknownoutputindex"),
@@ -460,23 +460,23 @@ function serializedIndexToIndex(serializedIndex) {
return /** @satisfies {InputIndex} */ (6);
case "outputindex":
return /** @satisfies {OutputIndex} */ (9);
case "p2pk33index":
case "p2pk33addressindex":
return /** @satisfies {P2PK33Index} */ (12);
case "p2pk65index":
case "p2pk65addressindex":
return /** @satisfies {P2PK65Index} */ (13);
case "p2pkhindex":
case "p2pkhaddressindex":
return /** @satisfies {P2PKHIndex} */ (14);
case "p2shindex":
case "p2shaddressindex":
return /** @satisfies {P2SHIndex} */ (15);
case "p2trindex":
case "p2traddressindex":
return /** @satisfies {P2TRIndex} */ (16);
case "p2wpkhindex":
case "p2wpkhaddressindex":
return /** @satisfies {P2WPKHIndex} */ (17);
case "p2wshindex":
case "p2wshaddressindex":
return /** @satisfies {P2WSHIndex} */ (18);
case "p2aindex":
case "p2aaddressindex":
return /** @satisfies {P2AIndex} */ (10);
case "p2msindex":
case "p2msoutputindex":
return /** @satisfies {P2MSIndex} */ (11);
case "opreturnindex":
return /** @satisfies {OpReturnIndex} */ (8);

File diff suppressed because it is too large Load Diff