pub enum ServerVtxoPolicy {
User(VtxoPolicy),
Checkpoint(CheckpointVtxoPolicy),
Expiry(ExpiryVtxoPolicy),
HarkLeaf(HarkLeafVtxoPolicy),
HarkForfeit(HarkForfeitVtxoPolicy),
}Expand description
Server-internal VTXO policy.
This is a superset of VtxoPolicy used by the server for internal tracking. Includes policies without user public keys.
Variants§
User(VtxoPolicy)
Wraps any user-facing policy.
Checkpoint(CheckpointVtxoPolicy)
A policy which returns all coins to the server after expiry.
Expiry(ExpiryVtxoPolicy)
Server-only policy where coins can only be swept by the server after expiry.
HarkLeaf(HarkLeafVtxoPolicy)
hArk leaf output policy (intermediate outputs spent by leaf txs).
HarkForfeit(HarkForfeitVtxoPolicy)
hArk forfeit tx output policy
Implementations§
Source§impl ServerVtxoPolicy
impl ServerVtxoPolicy
pub fn new_checkpoint(user_pubkey: PublicKey) -> Self
pub fn new_expiry(internal_key: XOnlyPublicKey) -> Self
pub fn new_hark_leaf(user_pubkey: PublicKey, unlock_hash: UnlockHash) -> Self
pub fn new_hark_forfeit(user_pubkey: PublicKey, unlock_hash: UnlockHash) -> Self
Sourcepub fn policy_type(&self) -> VtxoPolicyKind
pub fn policy_type(&self) -> VtxoPolicyKind
The policy type id.
Sourcepub fn is_arkoor_compatible(&self) -> bool
pub fn is_arkoor_compatible(&self) -> bool
Whether a Vtxo with this output can be spent in an arkoor tx.
Sourcepub fn user_pubkey(&self) -> Option<PublicKey>
pub fn user_pubkey(&self) -> Option<PublicKey>
Returns the user pubkey if this policy has one.
pub fn taproot( &self, server_pubkey: PublicKey, exit_delta: BlockDelta, expiry_height: BlockHeight, ) -> TaprootSpendInfo
pub fn script_pubkey( &self, server_pubkey: PublicKey, exit_delta: BlockDelta, expiry_height: BlockHeight, ) -> ScriptBuf
pub fn clauses( &self, exit_delta: u16, expiry_height: BlockHeight, server_pubkey: PublicKey, ) -> Vec<VtxoClause>
Sourcepub fn is_user_policy(&self) -> bool
pub fn is_user_policy(&self) -> bool
Check whether this is a user policy
Sourcepub fn into_user_policy(self) -> Option<VtxoPolicy>
pub fn into_user_policy(self) -> Option<VtxoPolicy>
Try to convert to a user policy if it is one
Trait Implementations§
Source§impl Clone for ServerVtxoPolicy
impl Clone for ServerVtxoPolicy
Source§fn clone(&self) -> ServerVtxoPolicy
fn clone(&self) -> ServerVtxoPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServerVtxoPolicy
impl Debug for ServerVtxoPolicy
Source§impl From<CheckpointVtxoPolicy> for ServerVtxoPolicy
impl From<CheckpointVtxoPolicy> for ServerVtxoPolicy
Source§fn from(policy: CheckpointVtxoPolicy) -> Self
fn from(policy: CheckpointVtxoPolicy) -> Self
Converts to this type from the input type.
Source§impl From<HarkForfeitVtxoPolicy> for ServerVtxoPolicy
impl From<HarkForfeitVtxoPolicy> for ServerVtxoPolicy
Source§fn from(v: HarkForfeitVtxoPolicy) -> Self
fn from(v: HarkForfeitVtxoPolicy) -> Self
Converts to this type from the input type.
Source§impl From<HarkLeafVtxoPolicy> for ServerVtxoPolicy
impl From<HarkLeafVtxoPolicy> for ServerVtxoPolicy
Source§fn from(p: HarkLeafVtxoPolicy) -> Self
fn from(p: HarkLeafVtxoPolicy) -> Self
Converts to this type from the input type.
Source§impl From<VtxoPolicy> for ServerVtxoPolicy
impl From<VtxoPolicy> for ServerVtxoPolicy
Source§fn from(p: VtxoPolicy) -> Self
fn from(p: VtxoPolicy) -> Self
Converts to this type from the input type.
Source§impl Hash for ServerVtxoPolicy
impl Hash for ServerVtxoPolicy
Source§impl Ord for ServerVtxoPolicy
impl Ord for ServerVtxoPolicy
Source§fn cmp(&self, other: &ServerVtxoPolicy) -> Ordering
fn cmp(&self, other: &ServerVtxoPolicy) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ServerVtxoPolicy
impl PartialEq for ServerVtxoPolicy
Source§impl PartialOrd for ServerVtxoPolicy
impl PartialOrd for ServerVtxoPolicy
Source§impl Policy for ServerVtxoPolicy
impl Policy for ServerVtxoPolicy
fn policy_type(&self) -> VtxoPolicyKind
fn taproot( &self, server_pubkey: PublicKey, exit_delta: BlockDelta, expiry_height: BlockHeight, ) -> TaprootSpendInfo
fn clauses( &self, exit_delta: u16, expiry_height: BlockHeight, server_pubkey: PublicKey, ) -> Vec<VtxoClause>
fn script_pubkey( &self, server_pubkey: PublicKey, exit_delta: BlockDelta, expiry_height: BlockHeight, ) -> ScriptBuf
fn txout( &self, amount: Amount, server_pubkey: PublicKey, exit_delta: BlockDelta, expiry_height: BlockHeight, ) -> TxOut
Source§impl ProtocolEncoding for ServerVtxoPolicy
impl ProtocolEncoding for ServerVtxoPolicy
Source§fn encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<(), Error>
fn encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<(), Error>
Encode the object into the writer.
Source§fn decode<R: Read + ?Sized>(r: &mut R) -> Result<Self, ProtocolDecodingError>
fn decode<R: Read + ?Sized>(r: &mut R) -> Result<Self, ProtocolDecodingError>
Decode the object from the writer.
Source§fn deserialize(byte_slice: &[u8]) -> Result<Self, ProtocolDecodingError>
fn deserialize(byte_slice: &[u8]) -> Result<Self, ProtocolDecodingError>
Deserialize object from the given byte slice.
Source§fn serialize_hex(&self) -> String
fn serialize_hex(&self) -> String
Serialize the object to a lowercase hex string.
Source§fn deserialize_hex(hex_str: &str) -> Result<Self, ProtocolDecodingError>
fn deserialize_hex(hex_str: &str) -> Result<Self, ProtocolDecodingError>
Deserialize object from hex slice.
impl Eq for ServerVtxoPolicy
impl StructuralPartialEq for ServerVtxoPolicy
Auto Trait Implementations§
impl Freeze for ServerVtxoPolicy
impl RefUnwindSafe for ServerVtxoPolicy
impl Send for ServerVtxoPolicy
impl Sync for ServerVtxoPolicy
impl Unpin for ServerVtxoPolicy
impl UnwindSafe for ServerVtxoPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.