pub struct Vtxo { /* private fields */ }Expand description
Represents a VTXO in the Ark.
The correctness of the return values of methods on this type is conditional on the VTXO being valid. For invalid VTXOs, the methods should never panic, but can return incorrect values. It is advised to always validate a VTXO upon receipt using Vtxo::validate.
Be mindful of calling Clone on a Vtxo, as they can be of non-negligible size. It is advised to use references where possible or use an std::rc::Rc or std::sync::Arc if needed.
Implementations of PartialEq, Eq, PartialOrd, Ord and Hash are proxied to the implementation on Vtxo::id.
Implementations§
Source§impl Vtxo
impl Vtxo
Sourcepub fn id(&self) -> VtxoId
pub fn id(&self) -> VtxoId
Get the identifier for this Vtxo.
This is the same as Vtxo::point but encoded as a byte array.
Sourcepub fn point(&self) -> OutPoint
pub fn point(&self) -> OutPoint
The outpoint from which to build forfeit or arkoor txs.
This can be an on-chain utxo or an off-chain vtxo.
Sourcepub fn chain_anchor(&self) -> OutPoint
pub fn chain_anchor(&self) -> OutPoint
The UTXO that should be confirmed for this Vtxo to be valid.
It is the very root of the VTXO.
Sourcepub fn policy(&self) -> &VtxoPolicy
pub fn policy(&self) -> &VtxoPolicy
The output policy of this VTXO.
Sourcepub fn policy_type(&self) -> VtxoPolicyKind
pub fn policy_type(&self) -> VtxoPolicyKind
The output policy type of this VTXO.
Sourcepub fn expiry_height(&self) -> BlockHeight
pub fn expiry_height(&self) -> BlockHeight
The expiry height of the Vtxo.
Sourcepub fn server_pubkey(&self) -> PublicKey
pub fn server_pubkey(&self) -> PublicKey
The server pubkey used in arkoor transitions.
Sourcepub fn exit_delta(&self) -> BlockDelta
pub fn exit_delta(&self) -> BlockDelta
The relative timelock block delta used for exits.
Sourcepub fn exit_depth(&self) -> u16
pub fn exit_depth(&self) -> u16
Returns the total exit depth (including OOR depth) of the vtxo.
Sourcepub fn arkoor_depth(&self) -> u16
pub fn arkoor_depth(&self) -> u16
Returns the OOR depth of the vtxo.
Sourcepub fn server_htlc_out_payment_hash(&self) -> Option<PaymentHash>
pub fn server_htlc_out_payment_hash(&self) -> Option<PaymentHash>
Get the payment hash if this vtxo is an HTLC send arkoor vtxo.
Sourcepub fn is_arkoor_compatible(&self) -> bool
pub fn is_arkoor_compatible(&self) -> bool
Whether this Vtxo can be spent in an arkoor tx.
Sourcepub fn arkoor_pubkey(&self) -> Option<PublicKey>
pub fn arkoor_pubkey(&self) -> Option<PublicKey>
The public key used to cosign arkoor txs spending this Vtxo. This will return None if Vtxo::is_arkoor_compatible returns false.
Sourcepub fn past_arkoor_pubkeys(&self) -> impl Iterator<Item = PublicKey> + '_
pub fn past_arkoor_pubkeys(&self) -> impl Iterator<Item = PublicKey> + '_
Iterate over all arkoor pubkeys in the arkoor chain of this vtxo.
This does not include the current arkoor pubkey, for that use Vtxo::arkoor_pubkey.
Sourcepub fn user_pubkey(&self) -> PublicKey
pub fn user_pubkey(&self) -> PublicKey
Returns the user pubkey associated with this Vtxo.
Sourcepub fn output_taproot(&self) -> TaprootSpendInfo
pub fn output_taproot(&self) -> TaprootSpendInfo
The taproot spend info for the output of this Vtxo.
Sourcepub fn output_script_pubkey(&self) -> ScriptBuf
pub fn output_script_pubkey(&self) -> ScriptBuf
The scriptPubkey of the output of this Vtxo.
Sourcepub fn is_arkoor(&self) -> bool
pub fn is_arkoor(&self) -> bool
Whether this VTXO contains our-of-round parts. This is true for both arkoor and lightning vtxos.
Sourcepub fn transactions(&self) -> VtxoTxIter<'_> ⓘ
pub fn transactions(&self) -> VtxoTxIter<'_> ⓘ
Iterator that constructs all the exit txs for this Vtxo.
Sourcepub fn claim_satisfaction_weight(&self) -> Weight
pub fn claim_satisfaction_weight(&self) -> Weight
The satisfaction weight required to spend the output when doing a unilateral exit.
Sourcepub fn round_cosign_pubkeys(&self) -> Vec<PublicKey>
pub fn round_cosign_pubkeys(&self) -> Vec<PublicKey>
The set of cosign pubkeys that is present in all of the exit nodes of the non-arkoor part of the exit path.
Sourcepub fn arkoor_pubkeys(&self) -> HashSet<PublicKey>
pub fn arkoor_pubkeys(&self) -> HashSet<PublicKey>
The set of all arkoor pubkeys present in the arkoor part of the VTXO exit path.
Sourcepub fn validate(
&self,
chain_anchor_tx: &Transaction,
) -> Result<ValidationResult, VtxoValidationError>
pub fn validate( &self, chain_anchor_tx: &Transaction, ) -> Result<ValidationResult, VtxoValidationError>
Fully validate this VTXO and its entire transaction chain.
The chain_anchor_tx must be the tx with txid matching
Vtxo::chain_anchor.