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
impl UnsignedVtxoTree
pub fn new(spec: VtxoTreeSpec, utxo: OutPoint) -> UnsignedVtxoTree
pub fn nb_leaves(&self) -> usize
pub fn nb_nodes(&self) -> usize
Sourcepub fn cosign_branch(
&self,
cosign_agg_nonces: &[AggregatedNonce],
leaf_idx: usize,
cosign_key: &Keypair,
cosign_sec_nonces: Vec<SecretNonce>,
) -> Result<Vec<PartialSignature>, IncorrectSigningKeyError>
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.
Sourcepub fn cosign_tree(
&self,
cosign_agg_nonces: &[AggregatedNonce],
keypair: &Keypair,
cosign_sec_nonces: Vec<SecretNonce>,
) -> Vec<PartialSignature>
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.
Sourcepub fn verify_branch_cosign_partial_sigs(
&self,
cosign_agg_nonces: &[AggregatedNonce],
request: &SignedVtxoRequest,
cosign_pub_nonces: &[PublicNonce],
cosign_part_sigs: &[PartialSignature],
) -> Result<(), String>
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.
Sourcepub fn verify_global_cosign_partial_sigs(
&self,
pk: PublicKey,
agg_nonces: &[AggregatedNonce],
pub_nonces: &[PublicNonce],
part_sigs: &[PartialSignature],
) -> Result<(), CosignSignatureError>
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.
Sourcepub 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>
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.
Sourcepub fn verify_cosign_sigs(
&self,
signatures: &[Signature],
) -> Result<(), XOnlyPublicKey>
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.
Sourcepub fn into_signed_tree(self, signatures: Vec<Signature>) -> SignedVtxoTreeSpec
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
impl Clone for UnsignedVtxoTree
Source§fn clone(&self) -> UnsignedVtxoTree
fn clone(&self) -> UnsignedVtxoTree
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more