Enum WitnessVersion
#[repr(u8)]pub enum WitnessVersion {
Show 17 variants
V0 = 0,
V1 = 1,
V2 = 2,
V3 = 3,
V4 = 4,
V5 = 5,
V6 = 6,
V7 = 7,
V8 = 8,
V9 = 9,
V10 = 10,
V11 = 11,
V12 = 12,
V13 = 13,
V14 = 14,
V15 = 15,
V16 = 16,
}
Expand description
Version of the segregated witness program.
Helps limit possible versions of the witness according to the specification. If a plain u8
type was used instead it would mean that the version may be > 16, which would be incorrect.
First byte of scriptPubkey
in transaction output for transactions starting with opcodes
ranging from 0 to 16 (inclusive).
Variants§
V0 = 0
Initial version of witness program. Used for P2WPKH and P2WPK outputs
V1 = 1
Version of witness program used for Taproot P2TR outputs.
V2 = 2
Future (unsupported) version of witness program.
V3 = 3
Future (unsupported) version of witness program.
V4 = 4
Future (unsupported) version of witness program.
V5 = 5
Future (unsupported) version of witness program.
V6 = 6
Future (unsupported) version of witness program.
V7 = 7
Future (unsupported) version of witness program.
V8 = 8
Future (unsupported) version of witness program.
V9 = 9
Future (unsupported) version of witness program.
V10 = 10
Future (unsupported) version of witness program.
V11 = 11
Future (unsupported) version of witness program.
V12 = 12
Future (unsupported) version of witness program.
V13 = 13
Future (unsupported) version of witness program.
V14 = 14
Future (unsupported) version of witness program.
V15 = 15
Future (unsupported) version of witness program.
V16 = 16
Future (unsupported) version of witness program.
Implementations§
§impl WitnessVersion
impl WitnessVersion
pub fn to_num(self) -> u8
pub fn to_num(self) -> u8
Returns integer version number representation for a given WitnessVersion
value.
NB: this is not the same as an integer representation of the opcode signifying witness version in bitcoin script. Thus, there is no function to directly convert witness version into a byte since the conversion requires context (bitcoin script or just a version number).
pub fn to_fe(self) -> Fe32
pub fn to_fe(self) -> Fe32
Converts this witness version to a GF32 field element.
Trait Implementations§
§impl Clone for WitnessVersion
impl Clone for WitnessVersion
§fn clone(&self) -> WitnessVersion
fn clone(&self) -> WitnessVersion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for WitnessVersion
impl Debug for WitnessVersion
§impl Display for WitnessVersion
impl Display for WitnessVersion
Prints WitnessVersion
number (from 0 to 16) as integer, without any prefix or suffix.
§impl From<WitnessVersion> for Fe32
impl From<WitnessVersion> for Fe32
§fn from(version: WitnessVersion) -> Fe32
fn from(version: WitnessVersion) -> Fe32
§impl From<WitnessVersion> for Opcode
impl From<WitnessVersion> for Opcode
§fn from(version: WitnessVersion) -> Opcode
fn from(version: WitnessVersion) -> Opcode
§impl FromStr for WitnessVersion
impl FromStr for WitnessVersion
§type Err = FromStrError
type Err = FromStrError
§fn from_str(s: &str) -> Result<WitnessVersion, <WitnessVersion as FromStr>::Err>
fn from_str(s: &str) -> Result<WitnessVersion, <WitnessVersion as FromStr>::Err>
s
to return a value of this type. Read more§impl Hash for WitnessVersion
impl Hash for WitnessVersion
§impl Ord for WitnessVersion
impl Ord for WitnessVersion
§impl PartialEq for WitnessVersion
impl PartialEq for WitnessVersion
§impl PartialOrd for WitnessVersion
impl PartialOrd for WitnessVersion
§impl TryFrom<Fe32> for WitnessVersion
impl TryFrom<Fe32> for WitnessVersion
§type Error = TryFromError
type Error = TryFromError
§fn try_from(
value: Fe32,
) -> Result<WitnessVersion, <WitnessVersion as TryFrom<Fe32>>::Error>
fn try_from( value: Fe32, ) -> Result<WitnessVersion, <WitnessVersion as TryFrom<Fe32>>::Error>
§impl<'a> TryFrom<Instruction<'a>> for WitnessVersion
impl<'a> TryFrom<Instruction<'a>> for WitnessVersion
§type Error = TryFromInstructionError
type Error = TryFromInstructionError
§fn try_from(
instruction: Instruction<'_>,
) -> Result<WitnessVersion, <WitnessVersion as TryFrom<Instruction<'a>>>::Error>
fn try_from( instruction: Instruction<'_>, ) -> Result<WitnessVersion, <WitnessVersion as TryFrom<Instruction<'a>>>::Error>
§impl TryFrom<Opcode> for WitnessVersion
impl TryFrom<Opcode> for WitnessVersion
§type Error = TryFromError
type Error = TryFromError
§fn try_from(
opcode: Opcode,
) -> Result<WitnessVersion, <WitnessVersion as TryFrom<Opcode>>::Error>
fn try_from( opcode: Opcode, ) -> Result<WitnessVersion, <WitnessVersion as TryFrom<Opcode>>::Error>
§impl TryFrom<u8> for WitnessVersion
impl TryFrom<u8> for WitnessVersion
§type Error = TryFromError
type Error = TryFromError
§fn try_from(
no: u8,
) -> Result<WitnessVersion, <WitnessVersion as TryFrom<u8>>::Error>
fn try_from( no: u8, ) -> Result<WitnessVersion, <WitnessVersion as TryFrom<u8>>::Error>
impl Copy for WitnessVersion
impl Eq for WitnessVersion
impl StructuralPartialEq for WitnessVersion
Auto Trait Implementations§
impl Freeze for WitnessVersion
impl RefUnwindSafe for WitnessVersion
impl Send for WitnessVersion
impl Sync for WitnessVersion
impl Unpin for WitnessVersion
impl UnwindSafe for WitnessVersion
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request