pub struct NumberOfBlocks(/* private fields */);Expand description
A relative lock time lock-by-height value.
Implementations§
Source§impl NumberOfBlocks
impl NumberOfBlocks
Sourcepub const MIN: Self = Self::ZERO
pub const MIN: Self = Self::ZERO
The minimum relative block height (0), can be included in any block.
Sourcepub const fn from_height(blocks: u16) -> Self
pub const fn from_height(blocks: u16) -> Self
Constructs a new NumberOfBlocks using a count of blocks.
Sourcepub const fn to_height(self) -> u16
pub const fn to_height(self) -> u16
Express the NumberOfBlocks as a count of blocks.
Sourcepub const fn to_consensus_u32(self) -> u32
👎Deprecated since 1.0.0-rc.0: use LockTime::from followed by to_consensus_u32 instead
pub const fn to_consensus_u32(self) -> u32
LockTime::from followed by to_consensus_u32 insteadReturns the u32 value used to encode this locktime in an nSequence field or
argument to OP_CHECKSEQUENCEVERIFY.
Sourcepub fn is_satisfied_by(
self,
chain_tip: BlockHeight,
utxo_mined_at: BlockHeight,
) -> Result<bool, InvalidHeightError>
pub fn is_satisfied_by( self, chain_tip: BlockHeight, utxo_mined_at: BlockHeight, ) -> Result<bool, InvalidHeightError>
Returns true if an output locked by height can be spent in the next block.
§Errors
If chain_tip as not after utxo_mined_at i.e., if you get the args mixed up.
Trait Implementations§
Source§impl<'a> Arbitrary<'a> for NumberOfBlocks
Available on crate feature arbitrary only.
impl<'a> Arbitrary<'a> for NumberOfBlocks
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl Binary for NumberOfBlocks
impl Binary for NumberOfBlocks
Source§impl Clone for NumberOfBlocks
impl Clone for NumberOfBlocks
Source§fn clone(&self) -> NumberOfBlocks
fn clone(&self) -> NumberOfBlocks
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NumberOfBlocks
impl Debug for NumberOfBlocks
Source§impl Default for NumberOfBlocks
impl Default for NumberOfBlocks
Source§fn default() -> NumberOfBlocks
fn default() -> NumberOfBlocks
Source§impl Display for NumberOfBlocks
impl Display for NumberOfBlocks
Source§impl From<NumberOfBlocks> for BlockHeightInterval
impl From<NumberOfBlocks> for BlockHeightInterval
Source§fn from(h: NumberOfBlocks) -> Self
fn from(h: NumberOfBlocks) -> Self
Converts a locktime::relative::NumberOfBlocks to a BlockHeightInterval.
A relative locktime block height has a maximum value of u16::MAX where as a
BlockHeightInterval is a thin wrapper around a u32, the two types are not interchangeable.
Source§impl From<NumberOfBlocks> for LockTime
impl From<NumberOfBlocks> for LockTime
Source§fn from(h: NumberOfBlocks) -> Self
fn from(h: NumberOfBlocks) -> Self
Source§impl From<u16> for NumberOfBlocks
impl From<u16> for NumberOfBlocks
Source§impl FromStr for NumberOfBlocks
impl FromStr for NumberOfBlocks
Source§impl Hash for NumberOfBlocks
impl Hash for NumberOfBlocks
Source§impl LowerHex for NumberOfBlocks
impl LowerHex for NumberOfBlocks
Source§impl Octal for NumberOfBlocks
impl Octal for NumberOfBlocks
Source§impl Ord for NumberOfBlocks
impl Ord for NumberOfBlocks
Source§fn cmp(&self, other: &NumberOfBlocks) -> Ordering
fn cmp(&self, other: &NumberOfBlocks) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for NumberOfBlocks
impl PartialEq for NumberOfBlocks
Source§impl PartialOrd for NumberOfBlocks
impl PartialOrd for NumberOfBlocks
Source§impl TryFrom<&str> for NumberOfBlocks
impl TryFrom<&str> for NumberOfBlocks
Source§impl TryFrom<BlockHeightInterval> for NumberOfBlocks
impl TryFrom<BlockHeightInterval> for NumberOfBlocks
Source§fn try_from(h: BlockHeightInterval) -> Result<Self, Self::Error>
fn try_from(h: BlockHeightInterval) -> Result<Self, Self::Error>
Converts a BlockHeightInterval to a locktime::relative::NumberOfBlocks.
A relative locktime block height has a maximum value of u16::MAX where as a
BlockHeightInterval is a thin wrapper around a u32, the two types are not interchangeable.
Source§type Error = TooBigForRelativeHeightError
type Error = TooBigForRelativeHeightError
Source§impl TryFrom<String> for NumberOfBlocks
Available on crate feature alloc only.
impl TryFrom<String> for NumberOfBlocks
alloc only.