global: move addressindex_to_outputindex stores from computer to indexer

This commit is contained in:
nym21
2025-07-04 17:30:43 +02:00
parent 6d35c26b3f
commit 7f07b0daa7
47 changed files with 515 additions and 1391 deletions

View File

@@ -22,22 +22,14 @@ mod opreturnindex;
mod outputindex;
mod outputtype;
mod p2aaddressindex;
mod p2aaddressindex_outputindex;
mod p2msoutputindex;
mod p2pk33addressindex;
mod p2pk33addressindex_outputindex;
mod p2pk65addressindex;
mod p2pk65addressindex_outputindex;
mod p2pkhaddressindex;
mod p2pkhaddressindex_outputindex;
mod p2shaddressindex;
mod p2shaddressindex_outputindex;
mod p2traddressindex;
mod p2traddressindex_outputindex;
mod p2wpkhaddressindex;
mod p2wpkhaddressindex_outputindex;
mod p2wshaddressindex;
mod p2wshaddressindex_outputindex;
mod quarterindex;
mod rawlocktime;
mod sats;
@@ -53,6 +45,7 @@ mod txidprefix;
mod txindex;
mod txversion;
mod typeindex;
mod typeindex_with_outputindex;
mod unit;
mod unknownoutputindex;
mod version;
@@ -86,22 +79,14 @@ pub use opreturnindex::*;
pub use outputindex::*;
pub use outputtype::*;
pub use p2aaddressindex::*;
pub use p2aaddressindex_outputindex::*;
pub use p2msoutputindex::*;
pub use p2pk33addressindex::*;
pub use p2pk33addressindex_outputindex::*;
pub use p2pk65addressindex::*;
pub use p2pk65addressindex_outputindex::*;
pub use p2pkhaddressindex::*;
pub use p2pkhaddressindex_outputindex::*;
pub use p2shaddressindex::*;
pub use p2shaddressindex_outputindex::*;
pub use p2traddressindex::*;
pub use p2traddressindex_outputindex::*;
pub use p2wpkhaddressindex::*;
pub use p2wpkhaddressindex_outputindex::*;
pub use p2wshaddressindex::*;
pub use p2wshaddressindex_outputindex::*;
pub use quarterindex::*;
pub use rawlocktime::*;
pub use sats::*;
@@ -117,6 +102,7 @@ pub use txidprefix::*;
pub use txindex::*;
pub use txversion::*;
pub use typeindex::*;
pub use typeindex_with_outputindex::*;
pub use unit::*;
pub use unknownoutputindex::*;
pub use version::*;

View File

@@ -1,55 +0,0 @@
use byteview::ByteView;
use serde::Serialize;
use crate::{TypeIndex, copy_first_4bytes, copy_first_8bytes};
use super::{OutputIndex, P2AAddressIndex};
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Serialize)]
pub struct P2AAddressIndexOutputindex {
addressindex: P2AAddressIndex,
outputindex: OutputIndex,
}
impl From<(TypeIndex, OutputIndex)> for P2AAddressIndexOutputindex {
fn from(value: (TypeIndex, OutputIndex)) -> Self {
Self::from((P2AAddressIndex::from(value.0), value.1))
}
}
impl From<(P2AAddressIndex, OutputIndex)> for P2AAddressIndexOutputindex {
fn from(value: (P2AAddressIndex, OutputIndex)) -> Self {
Self {
addressindex: value.0,
outputindex: value.1,
}
}
}
impl From<ByteView> for P2AAddressIndexOutputindex {
fn from(value: ByteView) -> Self {
let addressindex =
P2AAddressIndex::from(u32::from_be_bytes(copy_first_4bytes(&value).unwrap()));
let outputindex = OutputIndex::from(u64::from_be_bytes(copy_first_8bytes(&value).unwrap()));
Self {
addressindex,
outputindex,
}
}
}
impl From<P2AAddressIndexOutputindex> for ByteView {
fn from(value: P2AAddressIndexOutputindex) -> Self {
ByteView::from(&value)
}
}
impl From<&P2AAddressIndexOutputindex> for ByteView {
fn from(value: &P2AAddressIndexOutputindex) -> Self {
ByteView::from(
[
u32::from(value.addressindex).to_be_bytes().as_slice(),
u64::from(value.outputindex).to_be_bytes().as_slice(),
]
.concat(),
)
}
}

View File

@@ -1,55 +0,0 @@
use byteview::ByteView;
use serde::Serialize;
use crate::{TypeIndex, copy_first_4bytes, copy_first_8bytes};
use super::{OutputIndex, P2PK33AddressIndex};
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Serialize)]
pub struct P2PK33AddressIndexOutputindex {
addressindex: P2PK33AddressIndex,
outputindex: OutputIndex,
}
impl From<(TypeIndex, OutputIndex)> for P2PK33AddressIndexOutputindex {
fn from(value: (TypeIndex, OutputIndex)) -> Self {
Self::from((P2PK33AddressIndex::from(value.0), value.1))
}
}
impl From<(P2PK33AddressIndex, OutputIndex)> for P2PK33AddressIndexOutputindex {
fn from(value: (P2PK33AddressIndex, OutputIndex)) -> Self {
Self {
addressindex: value.0,
outputindex: value.1,
}
}
}
impl From<ByteView> for P2PK33AddressIndexOutputindex {
fn from(value: ByteView) -> Self {
let addressindex =
P2PK33AddressIndex::from(u32::from_be_bytes(copy_first_4bytes(&value).unwrap()));
let outputindex = OutputIndex::from(u64::from_be_bytes(copy_first_8bytes(&value).unwrap()));
Self {
addressindex,
outputindex,
}
}
}
impl From<P2PK33AddressIndexOutputindex> for ByteView {
fn from(value: P2PK33AddressIndexOutputindex) -> Self {
ByteView::from(&value)
}
}
impl From<&P2PK33AddressIndexOutputindex> for ByteView {
fn from(value: &P2PK33AddressIndexOutputindex) -> Self {
ByteView::from(
[
u32::from(value.addressindex).to_be_bytes().as_slice(),
u64::from(value.outputindex).to_be_bytes().as_slice(),
]
.concat(),
)
}
}

View File

@@ -1,55 +0,0 @@
use byteview::ByteView;
use serde::Serialize;
use crate::{TypeIndex, copy_first_4bytes, copy_first_8bytes};
use super::{OutputIndex, P2PK65AddressIndex};
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Serialize)]
pub struct P2PK65AddressIndexOutputindex {
addressindex: P2PK65AddressIndex,
outputindex: OutputIndex,
}
impl From<(TypeIndex, OutputIndex)> for P2PK65AddressIndexOutputindex {
fn from(value: (TypeIndex, OutputIndex)) -> Self {
Self::from((P2PK65AddressIndex::from(value.0), value.1))
}
}
impl From<(P2PK65AddressIndex, OutputIndex)> for P2PK65AddressIndexOutputindex {
fn from(value: (P2PK65AddressIndex, OutputIndex)) -> Self {
Self {
addressindex: value.0,
outputindex: value.1,
}
}
}
impl From<ByteView> for P2PK65AddressIndexOutputindex {
fn from(value: ByteView) -> Self {
let addressindex =
P2PK65AddressIndex::from(u32::from_be_bytes(copy_first_4bytes(&value).unwrap()));
let outputindex = OutputIndex::from(u64::from_be_bytes(copy_first_8bytes(&value).unwrap()));
Self {
addressindex,
outputindex,
}
}
}
impl From<P2PK65AddressIndexOutputindex> for ByteView {
fn from(value: P2PK65AddressIndexOutputindex) -> Self {
ByteView::from(&value)
}
}
impl From<&P2PK65AddressIndexOutputindex> for ByteView {
fn from(value: &P2PK65AddressIndexOutputindex) -> Self {
ByteView::from(
[
u32::from(value.addressindex).to_be_bytes().as_slice(),
u64::from(value.outputindex).to_be_bytes().as_slice(),
]
.concat(),
)
}
}

View File

@@ -1,55 +0,0 @@
use byteview::ByteView;
use serde::Serialize;
use crate::{TypeIndex, copy_first_4bytes, copy_first_8bytes};
use super::{OutputIndex, P2PKHAddressIndex};
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Serialize)]
pub struct P2PKHAddressIndexOutputindex {
addressindex: P2PKHAddressIndex,
outputindex: OutputIndex,
}
impl From<(TypeIndex, OutputIndex)> for P2PKHAddressIndexOutputindex {
fn from(value: (TypeIndex, OutputIndex)) -> Self {
Self::from((P2PKHAddressIndex::from(value.0), value.1))
}
}
impl From<(P2PKHAddressIndex, OutputIndex)> for P2PKHAddressIndexOutputindex {
fn from(value: (P2PKHAddressIndex, OutputIndex)) -> Self {
Self {
addressindex: value.0,
outputindex: value.1,
}
}
}
impl From<ByteView> for P2PKHAddressIndexOutputindex {
fn from(value: ByteView) -> Self {
let addressindex =
P2PKHAddressIndex::from(u32::from_be_bytes(copy_first_4bytes(&value).unwrap()));
let outputindex = OutputIndex::from(u64::from_be_bytes(copy_first_8bytes(&value).unwrap()));
Self {
addressindex,
outputindex,
}
}
}
impl From<P2PKHAddressIndexOutputindex> for ByteView {
fn from(value: P2PKHAddressIndexOutputindex) -> Self {
ByteView::from(&value)
}
}
impl From<&P2PKHAddressIndexOutputindex> for ByteView {
fn from(value: &P2PKHAddressIndexOutputindex) -> Self {
ByteView::from(
[
u32::from(value.addressindex).to_be_bytes().as_slice(),
u64::from(value.outputindex).to_be_bytes().as_slice(),
]
.concat(),
)
}
}

View File

@@ -1,55 +0,0 @@
use byteview::ByteView;
use serde::Serialize;
use crate::{TypeIndex, copy_first_4bytes, copy_first_8bytes};
use super::{OutputIndex, P2SHAddressIndex};
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Serialize)]
pub struct P2SHAddressIndexOutputindex {
addressindex: P2SHAddressIndex,
outputindex: OutputIndex,
}
impl From<(TypeIndex, OutputIndex)> for P2SHAddressIndexOutputindex {
fn from(value: (TypeIndex, OutputIndex)) -> Self {
Self::from((P2SHAddressIndex::from(value.0), value.1))
}
}
impl From<(P2SHAddressIndex, OutputIndex)> for P2SHAddressIndexOutputindex {
fn from(value: (P2SHAddressIndex, OutputIndex)) -> Self {
Self {
addressindex: value.0,
outputindex: value.1,
}
}
}
impl From<ByteView> for P2SHAddressIndexOutputindex {
fn from(value: ByteView) -> Self {
let addressindex =
P2SHAddressIndex::from(u32::from_be_bytes(copy_first_4bytes(&value).unwrap()));
let outputindex = OutputIndex::from(u64::from_be_bytes(copy_first_8bytes(&value).unwrap()));
Self {
addressindex,
outputindex,
}
}
}
impl From<P2SHAddressIndexOutputindex> for ByteView {
fn from(value: P2SHAddressIndexOutputindex) -> Self {
ByteView::from(&value)
}
}
impl From<&P2SHAddressIndexOutputindex> for ByteView {
fn from(value: &P2SHAddressIndexOutputindex) -> Self {
ByteView::from(
[
u32::from(value.addressindex).to_be_bytes().as_slice(),
u64::from(value.outputindex).to_be_bytes().as_slice(),
]
.concat(),
)
}
}

View File

@@ -1,55 +0,0 @@
use byteview::ByteView;
use serde::Serialize;
use crate::{TypeIndex, copy_first_4bytes, copy_first_8bytes};
use super::{OutputIndex, P2TRAddressIndex};
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Serialize)]
pub struct P2TRAddressIndexOutputindex {
addressindex: P2TRAddressIndex,
outputindex: OutputIndex,
}
impl From<(TypeIndex, OutputIndex)> for P2TRAddressIndexOutputindex {
fn from(value: (TypeIndex, OutputIndex)) -> Self {
Self::from((P2TRAddressIndex::from(value.0), value.1))
}
}
impl From<(P2TRAddressIndex, OutputIndex)> for P2TRAddressIndexOutputindex {
fn from(value: (P2TRAddressIndex, OutputIndex)) -> Self {
Self {
addressindex: value.0,
outputindex: value.1,
}
}
}
impl From<ByteView> for P2TRAddressIndexOutputindex {
fn from(value: ByteView) -> Self {
let addressindex =
P2TRAddressIndex::from(u32::from_be_bytes(copy_first_4bytes(&value).unwrap()));
let outputindex = OutputIndex::from(u64::from_be_bytes(copy_first_8bytes(&value).unwrap()));
Self {
addressindex,
outputindex,
}
}
}
impl From<P2TRAddressIndexOutputindex> for ByteView {
fn from(value: P2TRAddressIndexOutputindex) -> Self {
ByteView::from(&value)
}
}
impl From<&P2TRAddressIndexOutputindex> for ByteView {
fn from(value: &P2TRAddressIndexOutputindex) -> Self {
ByteView::from(
[
u32::from(value.addressindex).to_be_bytes().as_slice(),
u64::from(value.outputindex).to_be_bytes().as_slice(),
]
.concat(),
)
}
}

View File

@@ -1,55 +0,0 @@
use byteview::ByteView;
use serde::Serialize;
use crate::{TypeIndex, copy_first_4bytes, copy_first_8bytes};
use super::{OutputIndex, P2WPKHAddressIndex};
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Serialize)]
pub struct P2WPKHAddressIndexOutputindex {
addressindex: P2WPKHAddressIndex,
outputindex: OutputIndex,
}
impl From<(TypeIndex, OutputIndex)> for P2WPKHAddressIndexOutputindex {
fn from(value: (TypeIndex, OutputIndex)) -> Self {
Self::from((P2WPKHAddressIndex::from(value.0), value.1))
}
}
impl From<(P2WPKHAddressIndex, OutputIndex)> for P2WPKHAddressIndexOutputindex {
fn from(value: (P2WPKHAddressIndex, OutputIndex)) -> Self {
Self {
addressindex: value.0,
outputindex: value.1,
}
}
}
impl From<ByteView> for P2WPKHAddressIndexOutputindex {
fn from(value: ByteView) -> Self {
let addressindex =
P2WPKHAddressIndex::from(u32::from_be_bytes(copy_first_4bytes(&value).unwrap()));
let outputindex = OutputIndex::from(u64::from_be_bytes(copy_first_8bytes(&value).unwrap()));
Self {
addressindex,
outputindex,
}
}
}
impl From<P2WPKHAddressIndexOutputindex> for ByteView {
fn from(value: P2WPKHAddressIndexOutputindex) -> Self {
ByteView::from(&value)
}
}
impl From<&P2WPKHAddressIndexOutputindex> for ByteView {
fn from(value: &P2WPKHAddressIndexOutputindex) -> Self {
ByteView::from(
[
u32::from(value.addressindex).to_be_bytes().as_slice(),
u64::from(value.outputindex).to_be_bytes().as_slice(),
]
.concat(),
)
}
}

View File

@@ -1,55 +0,0 @@
use byteview::ByteView;
use serde::Serialize;
use crate::{TypeIndex, copy_first_4bytes, copy_first_8bytes};
use super::{OutputIndex, P2WSHAddressIndex};
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Serialize)]
pub struct P2WSHAddressIndexOutputindex {
addressindex: P2WSHAddressIndex,
outputindex: OutputIndex,
}
impl From<(TypeIndex, OutputIndex)> for P2WSHAddressIndexOutputindex {
fn from(value: (TypeIndex, OutputIndex)) -> Self {
Self::from((P2WSHAddressIndex::from(value.0), value.1))
}
}
impl From<(P2WSHAddressIndex, OutputIndex)> for P2WSHAddressIndexOutputindex {
fn from(value: (P2WSHAddressIndex, OutputIndex)) -> Self {
Self {
addressindex: value.0,
outputindex: value.1,
}
}
}
impl From<ByteView> for P2WSHAddressIndexOutputindex {
fn from(value: ByteView) -> Self {
let addressindex =
P2WSHAddressIndex::from(u32::from_be_bytes(copy_first_4bytes(&value).unwrap()));
let outputindex = OutputIndex::from(u64::from_be_bytes(copy_first_8bytes(&value).unwrap()));
Self {
addressindex,
outputindex,
}
}
}
impl From<P2WSHAddressIndexOutputindex> for ByteView {
fn from(value: P2WSHAddressIndexOutputindex) -> Self {
ByteView::from(&value)
}
}
impl From<&P2WSHAddressIndexOutputindex> for ByteView {
fn from(value: &P2WSHAddressIndexOutputindex) -> Self {
ByteView::from(
[
u32::from(value.addressindex).to_be_bytes().as_slice(),
u64::from(value.outputindex).to_be_bytes().as_slice(),
]
.concat(),
)
}
}

View File

@@ -0,0 +1,48 @@
use byteview::ByteView;
use serde::Serialize;
use crate::{TypeIndex, copy_first_4bytes, copy_first_8bytes};
use super::OutputIndex;
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Serialize)]
pub struct TypeIndexWithOutputindex {
typeindex: TypeIndex,
outputindex: OutputIndex,
}
impl From<(TypeIndex, OutputIndex)> for TypeIndexWithOutputindex {
fn from(value: (TypeIndex, OutputIndex)) -> Self {
Self {
typeindex: value.0,
outputindex: value.1,
}
}
}
impl From<ByteView> for TypeIndexWithOutputindex {
fn from(value: ByteView) -> Self {
let typeindex = TypeIndex::from(u32::from_be_bytes(copy_first_4bytes(&value).unwrap()));
let outputindex = OutputIndex::from(u64::from_be_bytes(copy_first_8bytes(&value).unwrap()));
Self {
typeindex,
outputindex,
}
}
}
impl From<TypeIndexWithOutputindex> for ByteView {
fn from(value: TypeIndexWithOutputindex) -> Self {
ByteView::from(&value)
}
}
impl From<&TypeIndexWithOutputindex> for ByteView {
fn from(value: &TypeIndexWithOutputindex) -> Self {
ByteView::from(
[
u32::from(value.typeindex).to_be_bytes().as_slice(),
u64::from(value.outputindex).to_be_bytes().as_slice(),
]
.concat(),
)
}
}