Struct revault_tx::scripts::DerivedDepositDescriptor [−][src]
pub struct DerivedDepositDescriptor(_);
Expand description
A concrete (with raw public keys) deposit Miniscript descriptor.
Implementations
Get all the keys and key source used in this derived descriptor
pub fn new(
stakeholders: Vec<DerivedPublicKey>
) -> Result<DerivedDepositDescriptor, ScriptCreationError>
pub fn new(
stakeholders: Vec<DerivedPublicKey>
) -> Result<DerivedDepositDescriptor, ScriptCreationError>
Get the derived miniscript descriptor for deposit outputs.
The deposit policy is an N-of-N, so thresh(len(all_pubkeys), all_pubkeys)
.
Examples
use revault_tx::{scripts, miniscript::{bitcoin::{self, secp256k1, util::bip32}, DescriptorTrait}};
use std::str::FromStr;
let first_stakeholder = scripts::DerivedPublicKey::from_str("[0f0f0f0f/21]02a17786aca5ea2118e9209702454ab432d5b2c656f8ae19447d4ff3e7317d3b41").unwrap();
let second_stakeholder = scripts::DerivedPublicKey::from_str("[0f0f0f0f/21]036edaec85bb1eee1a19ca9f9fd5620134ec98bc21cc14c4e8e3d0f8f121e1b6d1").unwrap();
let deposit_descriptor =
scripts::DerivedDepositDescriptor::new(vec![first_stakeholder, second_stakeholder]).expect("Compiling descriptor");
println!("Concrete deposit descriptor: {}", deposit_descriptor);
let desc_str = deposit_descriptor.to_string();
assert_eq!(deposit_descriptor, scripts::DerivedDepositDescriptor::from_str(&desc_str).unwrap());
Errors
- If the given vector contains less than 2 public keys.
- If the policy compilation to miniscript failed, which should not happen (tm) and would be a bug.
Trait Implementations
type Err = ScriptCreationError
type Err = ScriptCreationError
The associated error which can be returned from parsing.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for DerivedDepositDescriptor
impl Send for DerivedDepositDescriptor
impl Sync for DerivedDepositDescriptor
impl Unpin for DerivedDepositDescriptor
impl UnwindSafe for DerivedDepositDescriptor
Blanket Implementations
Mutably borrows from an owned value. Read more