computer: store part 10

This commit is contained in:
nym21
2025-07-05 17:44:51 +02:00
parent 5fe984c39d
commit d31d47eb32
39 changed files with 896 additions and 486 deletions

View File

@@ -28,6 +28,8 @@ use super::Vout;
pub struct OutputIndex(u64);
impl OutputIndex {
pub const ZERO: Self = Self(0);
pub const COINBASE: Self = Self(u64::MAX);
pub fn incremented(self) -> Self {

View File

@@ -67,6 +67,10 @@ impl OutputType {
}
}
pub fn is_not_address(&self) -> bool {
!self.is_address()
}
pub fn is_unspendable(&self) -> bool {
!self.is_spendable()
}

View File

@@ -31,6 +31,11 @@ impl From<TypeIndex> for P2AAddressIndex {
Self(value)
}
}
impl From<P2AAddressIndex> for TypeIndex {
fn from(value: P2AAddressIndex) -> Self {
value.0
}
}
impl From<P2AAddressIndex> for u32 {
fn from(value: P2AAddressIndex) -> Self {
Self::from(*value)

View File

@@ -31,6 +31,11 @@ impl From<TypeIndex> for P2PK33AddressIndex {
Self(value)
}
}
impl From<P2PK33AddressIndex> for TypeIndex {
fn from(value: P2PK33AddressIndex) -> Self {
value.0
}
}
impl From<P2PK33AddressIndex> for u32 {
fn from(value: P2PK33AddressIndex) -> Self {
Self::from(*value)

View File

@@ -31,6 +31,11 @@ impl From<TypeIndex> for P2PK65AddressIndex {
Self(value)
}
}
impl From<P2PK65AddressIndex> for TypeIndex {
fn from(value: P2PK65AddressIndex) -> Self {
value.0
}
}
impl From<P2PK65AddressIndex> for usize {
fn from(value: P2PK65AddressIndex) -> Self {
Self::from(*value)

View File

@@ -31,6 +31,11 @@ impl From<TypeIndex> for P2PKHAddressIndex {
Self(value)
}
}
impl From<P2PKHAddressIndex> for TypeIndex {
fn from(value: P2PKHAddressIndex) -> Self {
value.0
}
}
impl From<P2PKHAddressIndex> for usize {
fn from(value: P2PKHAddressIndex) -> Self {
Self::from(*value)

View File

@@ -31,6 +31,11 @@ impl From<TypeIndex> for P2SHAddressIndex {
Self(value)
}
}
impl From<P2SHAddressIndex> for TypeIndex {
fn from(value: P2SHAddressIndex) -> Self {
value.0
}
}
impl From<P2SHAddressIndex> for u32 {
fn from(value: P2SHAddressIndex) -> Self {
Self::from(*value)

View File

@@ -31,6 +31,11 @@ impl From<TypeIndex> for P2TRAddressIndex {
Self(value)
}
}
impl From<P2TRAddressIndex> for TypeIndex {
fn from(value: P2TRAddressIndex) -> Self {
value.0
}
}
impl From<P2TRAddressIndex> for u32 {
fn from(value: P2TRAddressIndex) -> Self {
Self::from(*value)

View File

@@ -31,6 +31,11 @@ impl From<TypeIndex> for P2WPKHAddressIndex {
Self(value)
}
}
impl From<P2WPKHAddressIndex> for TypeIndex {
fn from(value: P2WPKHAddressIndex) -> Self {
value.0
}
}
impl From<P2WPKHAddressIndex> for usize {
fn from(value: P2WPKHAddressIndex) -> Self {
Self::from(*value)

View File

@@ -31,6 +31,11 @@ impl From<TypeIndex> for P2WSHAddressIndex {
Self(value)
}
}
impl From<P2WSHAddressIndex> for TypeIndex {
fn from(value: P2WSHAddressIndex) -> Self {
value.0
}
}
impl From<P2WSHAddressIndex> for u32 {
fn from(value: P2WSHAddressIndex) -> Self {
Self::from(*value)