mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-07 12:49:10 -07:00
computer: store part 10
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user