Struct breez_sdk_core::bitcoin::blockdata::transaction::Sequence
pub struct Sequence(pub u32);
Expand description
Bitcoin transaction input sequence number.
The sequence field is used for:
- Indicating whether absolute lock-time (specified in
lock_time
field ofTransaction
) is enabled. - Indicating and encoding BIP-68 relative lock-times.
- Indicating whether a transcation opts-in to BIP-125 replace-by-fee.
Note that transactions spending an output with OP_CHECKLOCKTIMEVERIFY
MUST NOT use
Sequence::MAX
for the corresponding input. BIP-65
Tuple Fields§
§0: u32
Implementations§
§impl Sequence
impl Sequence
pub const MAX: Sequence = _
pub const MAX: Sequence = _
The maximum allowable sequence number.
This sequence number disables lock-time and replace-by-fee.
pub const ZERO: Sequence = _
pub const ZERO: Sequence = _
Zero value sequence.
This sequence number enables replace-by-fee and lock-time.
pub const ENABLE_LOCKTIME_NO_RBF: Sequence = Sequence::MIN_NO_RBF
pub const ENABLE_LOCKTIME_NO_RBF: Sequence = Sequence::MIN_NO_RBF
The sequence number that enables absolute lock-time but disables replace-by-fee and relative lock-time.
pub const ENABLE_RBF_NO_LOCKTIME: Sequence = _
pub const ENABLE_RBF_NO_LOCKTIME: Sequence = _
The sequence number that enables replace-by-fee and absolute lock-time but disables relative lock-time.
pub fn is_final(&self) -> bool
pub fn is_final(&self) -> bool
Retuns true
if the sequence number indicates that the transaction is finalised.
The sequence number being equal to 0xffffffff on all txin sequences indicates that the transaction is finalised.
pub fn is_rbf(&self) -> bool
pub fn is_rbf(&self) -> bool
Returns true if the transaction opted-in to BIP125 replace-by-fee.
Replace by fee is signaled by the sequence being less than 0xfffffffe which is checked by this method.
pub fn is_relative_lock_time(&self) -> bool
pub fn is_relative_lock_time(&self) -> bool
Returns true
if the sequence has a relative lock-time.
pub fn is_height_locked(&self) -> bool
pub fn is_height_locked(&self) -> bool
Returns true
if the sequence number encodes a block based relative lock-time.
pub fn is_time_locked(&self) -> bool
pub fn is_time_locked(&self) -> bool
Returns true
if the sequene number encodes a time interval based relative lock-time.
pub fn from_height(height: u16) -> Sequence
pub fn from_height(height: u16) -> Sequence
Create a relative lock-time using block height.
pub fn from_512_second_intervals(intervals: u16) -> Sequence
pub fn from_512_second_intervals(intervals: u16) -> Sequence
Create a relative lock-time using time intervals where each interval is equivalent to 512 seconds.
Encoding finer granularity of time for relative lock-times is not supported in Bitcoin
pub fn from_seconds_floor(
seconds: u32,
) -> Result<Sequence, RelativeLockTimeError>
pub fn from_seconds_floor( seconds: u32, ) -> Result<Sequence, RelativeLockTimeError>
Create a relative lock-time from seconds, converting the seconds into 512 second interval with floor division.
Will return an error if the input cannot be encoded in 16 bits.
pub fn from_seconds_ceil(
seconds: u32,
) -> Result<Sequence, RelativeLockTimeError>
pub fn from_seconds_ceil( seconds: u32, ) -> Result<Sequence, RelativeLockTimeError>
Create a relative lock-time from seconds, converting the seconds into 512 second interval with ceiling division.
Will return an error if the input cannot be encoded in 16 bits.
pub fn enables_absolute_lock_time(&self) -> bool
pub fn enables_absolute_lock_time(&self) -> bool
Returns true
if the sequence number enables absolute lock-time (Transaction::lock_time
).
pub fn from_consensus(n: u32) -> Sequence
pub fn from_consensus(n: u32) -> Sequence
Create a sequence from a u32 value.
pub fn to_consensus_u32(self) -> u32
pub fn to_consensus_u32(self) -> u32
Returns the inner 32bit integer value of Sequence.
Trait Implementations§
§impl<'de> Deserialize<'de> for Sequence
impl<'de> Deserialize<'de> for Sequence
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Sequence, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Sequence, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Ord for Sequence
impl Ord for Sequence
§impl PartialOrd for Sequence
impl PartialOrd for Sequence
§impl Serialize for Sequence
impl Serialize for Sequence
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for Sequence
impl Eq for Sequence
impl StructuralPartialEq for Sequence
Auto Trait Implementations§
impl Freeze for Sequence
impl RefUnwindSafe for Sequence
impl Send for Sequence
impl Sync for Sequence
impl Unpin for Sequence
impl UnwindSafe for Sequence
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any
.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any
.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
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request