pub struct SignedVtxoTreeSpec {
pub spec: VtxoTreeSpec,
pub utxo: OutPoint,
pub cosign_sigs: Vec<Signature>,
}Expand description
All the information needed to uniquely specify a fully signed VTXO tree.
Fields§
§spec: VtxoTreeSpec§utxo: OutPoint§cosign_sigs: Vec<Signature>The signatures for the internal txs, from leaves to root.
Implementations§
Source§impl SignedVtxoTreeSpec
impl SignedVtxoTreeSpec
Sourcepub fn new(
spec: VtxoTreeSpec,
utxo: OutPoint,
cosign_signatures: Vec<Signature>,
) -> SignedVtxoTreeSpec
pub fn new( spec: VtxoTreeSpec, utxo: OutPoint, cosign_signatures: Vec<Signature>, ) -> SignedVtxoTreeSpec
Signatures expected for internal nodes ordered from leaves to root.
pub fn nb_leaves(&self) -> usize
Sourcepub fn exit_branch(&self, leaf_idx: usize) -> Vec<Transaction>
pub fn exit_branch(&self, leaf_idx: usize) -> Vec<Transaction>
Construct the exit branch starting from the root ending in the leaf.
Panics if leaf_idx is out of range.
This call is quite inefficient and if you want to make repeated calls, it is advised to use CachedSignedVtxoTree::exit_branch instead.
Sourcepub fn all_final_txs(&self) -> Vec<Transaction>
pub fn all_final_txs(&self) -> Vec<Transaction>
Get all final txs in this tree, starting with the leaves, towards the root
pub fn into_cached_tree(self) -> CachedSignedVtxoTree
Sourcepub fn detect_hashlock_version(
&self,
) -> Result<HashlockVersion, HashlockVersionDetectError>
pub fn detect_hashlock_version( &self, ) -> Result<HashlockVersion, HashlockVersionDetectError>
Detect the hashlock version this tree was signed with.
We forgot to properly encode this, so it detects it by looking at the first signature and seeing which version it is valid for.
Falls back to v1 for empty trees, they shouldn’t exist.
Sourcepub fn with_detected_hashlock_version(
self,
) -> Result<Self, HashlockVersionDetectError>
pub fn with_detected_hashlock_version( self, ) -> Result<Self, HashlockVersionDetectError>
Return this tree with its hashlock version detected from the cosign signatures.
Use this before rebuilding transactions or VTXOs from a stored tree that may predate the v1 hashlock clauses; see Self::detect_hashlock_version.
Trait Implementations§
Source§impl Clone for SignedVtxoTreeSpec
impl Clone for SignedVtxoTreeSpec
Source§fn clone(&self) -> SignedVtxoTreeSpec
fn clone(&self) -> SignedVtxoTreeSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more