Struct bdk_chain::bitcoin::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 copy 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
§fn eq(&self, other: &WitnessProgram) -> bool
fn eq(&self, other: &WitnessProgram) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.§impl PartialOrd for WitnessProgram
impl PartialOrd for WitnessProgram
§fn partial_cmp(&self, other: &WitnessProgram) -> Option<Ordering>
fn partial_cmp(&self, other: &WitnessProgram) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl 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§
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
§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