Struct miniscript::RelLockTime

source ·
pub struct RelLockTime(/* private fields */);
Expand description

A relative locktime which implements Ord.

Implementations§

source§

impl RelLockTime

source

pub const ZERO: Self = _

The “0 blocks” constant.

source

pub fn from_consensus(n: u32) -> Result<Self, RelLockTimeError>

Constructs an RelLockTime from an nLockTime value or the argument to CHEKCLOCKTIMEVERIFY.

source

pub fn to_consensus_u32(self) -> u32

Returns the inner u32 value. This is the value used when creating this LockTime i.e., n OP_CHECKSEQUENCEVERIFY or nSequence.

source

pub fn from_height(height: u16) -> Self

Takes a 16-bit number of blocks and produces a relative locktime from it.

source

pub fn from_512_second_intervals(time: u16) -> Self

Takes a 16-bit number of 512-second time intervals and produces a relative locktime from it.

source

pub fn is_height_locked(&self) -> bool

Whether this timelock is blockheight-based.

source

pub fn is_time_locked(&self) -> bool

Whether this timelock is time-based.

Trait Implementations§

source§

impl Clone for RelLockTime

source§

fn clone(&self) -> RelLockTime

Returns a copy 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 RelLockTime

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for RelLockTime

source§

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

Formats the value using the given formatter. Read more
source§

impl From<RelLockTime> for LockTime

source§

fn from(lock_time: RelLockTime) -> LockTime

Converts to this type from the input type.
source§

impl From<RelLockTime> for Sequence

source§

fn from(lock_time: RelLockTime) -> Sequence

Converts to this type from the input type.
source§

impl Hash for RelLockTime

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for RelLockTime

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<RelLockTime> for RelLockTime

source§

fn eq(&self, other: &RelLockTime) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<RelLockTime> for RelLockTime

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<Pk: MiniscriptKey + ToPublicKey> Satisfier<Pk> for RelLockTime

source§

fn check_older(&self, n: LockTime) -> bool

Assert whether an relative locktime is satisfied Read more
source§

fn lookup_ecdsa_sig(&self, _: &Pk) -> Option<Signature>

Given a public key, look up an ECDSA signature with that key
source§

fn lookup_tap_key_spend_sig(&self) -> Option<Signature>

Lookup the tap key spend sig
source§

fn lookup_tap_leaf_script_sig( &self, _: &Pk, _: &TapLeafHash ) -> Option<Signature>

Given a public key and a associated leaf hash, look up an schnorr signature with that key
source§

fn lookup_tap_control_block_map( &self ) -> Option<&BTreeMap<ControlBlock, (ScriptBuf, LeafVersion)>>

Obtain a reference to the control block for a ver and script
source§

fn lookup_raw_pkh_pk(&self, _: &Hash) -> Option<PublicKey>

Given a raw Pkh, lookup corresponding bitcoin::PublicKey
source§

fn lookup_raw_pkh_x_only_pk(&self, _: &Hash) -> Option<XOnlyPublicKey>

Given a raw Pkh, lookup corresponding bitcoin::secp256k1::XOnlyPublicKey
source§

fn lookup_raw_pkh_ecdsa_sig(&self, _: &Hash) -> Option<(PublicKey, Signature)>

Given a keyhash, look up the EC signature and the associated key Even if signatures for public key Hashes are not available, the users can use this map to provide pkh -> pk mapping which can be useful for dissatisfying pkh.
source§

fn lookup_raw_pkh_tap_leaf_script_sig( &self, _: &(Hash, TapLeafHash) ) -> Option<(XOnlyPublicKey, Signature)>

Given a keyhash, look up the schnorr signature and the associated key Even if signatures for public key Hashes are not available, the users can use this map to provide pkh -> pk mapping which can be useful for dissatisfying pkh.
source§

fn lookup_sha256(&self, _: &Pk::Sha256) -> Option<Preimage32>

Given a SHA256 hash, look up its preimage
source§

fn lookup_hash256(&self, _: &Pk::Hash256) -> Option<Preimage32>

Given a HASH256 hash, look up its preimage
source§

fn lookup_ripemd160(&self, _: &Pk::Ripemd160) -> Option<Preimage32>

Given a RIPEMD160 hash, look up its preimage
source§

fn lookup_hash160(&self, _: &Pk::Hash160) -> Option<Preimage32>

Given a HASH160 hash, look up its preimage
source§

fn check_after(&self, _: LockTime) -> bool

Assert whether a absolute locktime is satisfied Read more
source§

impl TryFrom<Sequence> for RelLockTime

§

type Error = RelLockTimeError

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

fn try_from(seq: Sequence) -> Result<Self, RelLockTimeError>

Performs the conversion.
source§

impl Copy for RelLockTime

source§

impl Eq for RelLockTime

source§

impl StructuralEq for RelLockTime

source§

impl StructuralPartialEq for RelLockTime

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T, Pk> AssetProvider<Pk> for Twhere T: Satisfier<Pk>, Pk: MiniscriptKey + ToPublicKey,

source§

fn provider_lookup_ecdsa_sig(&self, pk: &Pk) -> bool

Given a public key, look up an ECDSA signature with that key, return whether we found it
source§

fn provider_lookup_tap_key_spend_sig(&self, _: &Pk) -> Option<usize>

Lookup the tap key spend sig and return its size
source§

fn provider_lookup_tap_leaf_script_sig( &self, pk: &Pk, leaf_hash: &TapLeafHash ) -> Option<usize>

Given a public key and a associated leaf hash, look up a schnorr signature with that key and return its size
source§

fn provider_lookup_tap_control_block_map( &self ) -> Option<&BTreeMap<ControlBlock, (ScriptBuf, LeafVersion), Global>>

Obtain a reference to the control block for a ver and script
source§

fn provider_lookup_raw_pkh_pk(&self, hash: &Hash) -> Option<PublicKey>

Given a raw Pkh, lookup corresponding bitcoin::PublicKey
source§

fn provider_lookup_raw_pkh_x_only_pk( &self, hash: &Hash ) -> Option<XOnlyPublicKey>

Given a raw Pkh, lookup corresponding bitcoin::secp256k1::XOnlyPublicKey
source§

fn provider_lookup_raw_pkh_ecdsa_sig(&self, hash: &Hash) -> Option<PublicKey>

Given a keyhash, look up the EC signature and the associated key. Returns the key if a signature is found. Even if signatures for public key Hashes are not available, the users can use this map to provide pkh -> pk mapping which can be useful for dissatisfying pkh.
source§

fn provider_lookup_raw_pkh_tap_leaf_script_sig( &self, hash: &(Hash, TapLeafHash) ) -> Option<(XOnlyPublicKey, usize)>

Given a keyhash, look up the schnorr signature and the associated key. Returns the key and sig len if a signature is found. Even if signatures for public key Hashes are not available, the users can use this map to provide pkh -> pk mapping which can be useful for dissatisfying pkh.
source§

fn provider_lookup_sha256(&self, hash: &<Pk as MiniscriptKey>::Sha256) -> bool

Given a SHA256 hash, look up its preimage, return whether we found it
source§

fn provider_lookup_hash256(&self, hash: &<Pk as MiniscriptKey>::Hash256) -> bool

Given a HASH256 hash, look up its preimage, return whether we found it
source§

fn provider_lookup_ripemd160( &self, hash: &<Pk as MiniscriptKey>::Ripemd160 ) -> bool

Given a RIPEMD160 hash, look up its preimage, return whether we found it
source§

fn provider_lookup_hash160(&self, hash: &<Pk as MiniscriptKey>::Hash160) -> bool

Given a HASH160 hash, look up its preimage, return whether we found it
source§

fn check_older(&self, s: LockTime) -> bool

Assert whether a relative locktime is satisfied
source§

fn check_after(&self, l: LockTime) -> bool

Assert whether an absolute locktime is satisfied
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.