UnsignedVtxoTree

Struct UnsignedVtxoTree 

Source
pub struct UnsignedVtxoTree {
    pub spec: VtxoTreeSpec,
    pub utxo: OutPoint,
    pub cosign_agg_pks: Vec<XOnlyPublicKey>,
    pub txs: Vec<Transaction>,
    pub sighashes: Vec<TapSighash>,
    /* private fields */
}
Expand description

A VTXO tree ready to be signed.

This type contains various cached values required to sign the tree.

Fields§

§spec: VtxoTreeSpec§utxo: OutPoint§cosign_agg_pks: Vec<XOnlyPublicKey>

Aggregate pubkeys for the inputs to all nodes, leaves to root.

§txs: Vec<Transaction>

Transactions for all nodes, leaves to root.

§sighashes: Vec<TapSighash>

Sighashes for the only input of the tx for all nodes, leaves to root.

Implementations§

Source§

impl UnsignedVtxoTree

Source

pub fn new(spec: VtxoTreeSpec, utxo: OutPoint) -> UnsignedVtxoTree

Source

pub fn nb_leaves(&self) -> usize

Source

pub fn nb_nodes(&self) -> usize

Source

pub fn cosign_branch( &self, cosign_agg_nonces: &[AggregatedNonce], leaf_idx: usize, cosign_key: &Keypair, cosign_sec_nonces: Vec<SecretNonce>, ) -> Result<Vec<PartialSignature>, IncorrectSigningKeyError>

Generate partial musig signatures for the nodes in the tree branch of the given vtxo request.

Note that the signatures are indexed by their place in the tree and thus do not necessarily match up with the indices in the secret nonces vector.

Aggregate nonces expected for all nodes, ordered from leaves to root. Secret nonces expected for branch, ordered from leaf to root.

Returns None if the vtxo request is not part of the tree. Returned signatures over the branch from leaf to root.

Source

pub fn cosign_tree( &self, cosign_agg_nonces: &[AggregatedNonce], keypair: &Keypair, cosign_sec_nonces: Vec<SecretNonce>, ) -> Vec<PartialSignature>

Generate partial musig signatures for all nodes in the tree.

Nonces expected for all nodes, ordered from leaves to root.

Returns None if the vtxo request is not part of the tree.

Source

pub fn verify_branch_cosign_partial_sigs( &self, cosign_agg_nonces: &[AggregatedNonce], request: &SignedVtxoRequest, cosign_pub_nonces: &[PublicNonce], cosign_part_sigs: &[PartialSignature], ) -> Result<(), String>

Verify the partial cosign signatures from one of the leaves.

Nonces and partial signatures expected ordered from leaves to root.

Source

pub fn verify_global_cosign_partial_sigs( &self, pk: PublicKey, agg_nonces: &[AggregatedNonce], pub_nonces: &[PublicNonce], part_sigs: &[PartialSignature], ) -> Result<(), CosignSignatureError>

Verify the partial cosign signatures for all nodes.

Nonces and partial signatures expected ordered from leaves to root.

Source

pub fn combine_partial_signatures( &self, cosign_agg_nonces: &[AggregatedNonce], leaf_part_sigs: &HashMap<PublicKey, Vec<PartialSignature>>, global_signer_part_sigs: &[impl AsRef<[PartialSignature]>], ) -> Result<Vec<Signature>, CosignSignatureError>

Combine all partial cosign signatures.

Nonces expected ordered from leaves to root. Leaf signatures expected over leaf branch ordered from leaf to root. server signatures expected ordered from leaves to root.

Source

pub fn verify_cosign_sigs( &self, signatures: &[Signature], ) -> Result<(), XOnlyPublicKey>

Verify the signatures of all the node txs.

Signatures expected ordered from leaves to root.

Source

pub fn into_signed_tree(self, signatures: Vec<Signature>) -> SignedVtxoTreeSpec

Convert into a SignedVtxoTreeSpec by providing the signatures.

Signatures expected ordered from leaves to root.

Trait Implementations§

Source§

impl Clone for UnsignedVtxoTree

Source§

fn clone(&self) -> UnsignedVtxoTree

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UnsignedVtxoTree

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V