Struct WitnessProgram
pub struct WitnessProgram { /* private fields */ }Expand description
The segregated witness program.
The segregated witness program is technically only the program bytes excluding the witness
version, however we maintain length invariants on the program that are governed by the version
number, therefore we carry the version number around along with the program bytes.
Implementations§
§impl WitnessProgram
impl WitnessProgram
pub fn new(
version: WitnessVersion,
bytes: &[u8],
) -> Result<WitnessProgram, Error>
pub fn new( version: WitnessVersion, bytes: &[u8], ) -> Result<WitnessProgram, Error>
Creates a new witness program, copying the content from the given byte slice.
pub fn p2wpkh(pk: &CompressedPublicKey) -> WitnessProgram
pub fn p2wpkh(pk: &CompressedPublicKey) -> WitnessProgram
Creates a WitnessProgram from pk for a P2WPKH output.
pub fn p2wsh(script: &Script) -> WitnessProgram
pub fn p2wsh(script: &Script) -> WitnessProgram
Creates a WitnessProgram from script for a P2WSH output.
pub fn p2tr<C>(
secp: &Secp256k1<C>,
internal_key: XOnlyPublicKey,
merkle_root: Option<TapNodeHash>,
) -> WitnessProgramwhere
C: Verification,
pub fn p2tr<C>(
secp: &Secp256k1<C>,
internal_key: XOnlyPublicKey,
merkle_root: Option<TapNodeHash>,
) -> WitnessProgramwhere
C: Verification,
Creates a pay to taproot address from an untweaked key.
pub fn p2tr_tweaked(output_key: TweakedPublicKey) -> WitnessProgram
pub fn p2tr_tweaked(output_key: TweakedPublicKey) -> WitnessProgram
Creates a pay to taproot address from a pre-tweaked output key.
pub fn version(&self) -> WitnessVersion
pub fn version(&self) -> WitnessVersion
Returns the witness program version.
Trait Implementations§
§impl Clone for WitnessProgram
impl Clone for WitnessProgram
§fn clone(&self) -> WitnessProgram
fn clone(&self) -> WitnessProgram
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for WitnessProgram
impl Debug for WitnessProgram
§impl Hash for WitnessProgram
impl Hash for WitnessProgram
§impl Ord for WitnessProgram
impl Ord for WitnessProgram
§impl PartialEq for WitnessProgram
impl PartialEq for WitnessProgram
§impl PartialOrd for WitnessProgram
impl PartialOrd for WitnessProgram
impl Copy for WitnessProgram
impl Eq for WitnessProgram
impl StructuralPartialEq for WitnessProgram
Auto Trait Implementations§
impl Freeze for WitnessProgram
impl RefUnwindSafe for WitnessProgram
impl Send for WitnessProgram
impl Sync for WitnessProgram
impl Unpin for WitnessProgram
impl UnwindSafe for WitnessProgram
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
§impl<T> AnySync for T
impl<T> AnySync 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
Mutably borrows from an owned value. Read more
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
Compare self to
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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
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
Checks if this value is equivalent to the given key. Read more
§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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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>
Wrap the input message
T in a tonic::Request