Skip to content

Commit

Permalink
Merge rust-bitcoin#3439: sequence: clarify sequence constant name and…
Browse files Browse the repository at this point in the history
… add FINAL

4499b5c feat: rename ENABLE_RBF_NO_LOCKTIME to ENABLE_LOCKTIME_AND_RBF (ChrisCho-H)
861d97d feat: add FINAL constant to disable all (ChrisCho-H)

Pull request description:

  c24630e
  - `LOCKTIME` is used for both absolute and relative one without clear classification, which is confusing and could lead to an unexpected bug. Although it's API breaking change, current constant is so ambiguous unless understand the details of `LOCKTIME` semantic.

  9cc5dfe
  - Add constant `ENABLE_ALL` and `DISABLE_ALL`, which is useful for those who want to enable(disable) rbf, absolute/relative locktime.

ACKs for top commit:
  tcharding:
    ACK 4499b5c
  apoelstra:
    ACK 4499b5c successfully ran local tests

Tree-SHA512: dbea5ae911556d53025078e7193f0972d5e8ba354f69692091b2b05cc441e270f25eafa55b144a6970de42d8f596a2b0103cdee463c3126d5d9986cee88ce8fc
  • Loading branch information
apoelstra committed Oct 8, 2024
2 parents 6892b62 + 4499b5c commit 0a83e53
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion primitives/src/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,29 @@ pub struct Sequence(pub u32);
impl Sequence {
/// The maximum allowable sequence number.
///
/// This sequence number disables absolute lock time and replace-by-fee.
/// The sequence number that disables replace-by-fee, absolute lock time and relative lock time.
pub const MAX: Self = Sequence(0xFFFFFFFF);
/// Zero value sequence.
///
/// This sequence number enables replace-by-fee and absolute lock time.
pub const ZERO: Self = Sequence(0);
/// The sequence number that disables replace-by-fee, absolute lock time and relative lock time.
pub const FINAL: Self = Sequence::MAX;
/// The sequence number that enables absolute lock time but disables replace-by-fee
/// and relative lock time.
pub const ENABLE_LOCKTIME_NO_RBF: Self = Sequence::MIN_NO_RBF;
/// The sequence number that enables replace-by-fee and absolute lock time but
/// disables relative lock time.
#[deprecated(
since = "TBD",
note = "This constant has ambiguous name. Please use ENABLE_LOCKTIME_AND_RBF instead."
)]
pub const ENABLE_RBF_NO_LOCKTIME: Self = Sequence(0xFFFFFFFD);
/// The maximum sequence number that enables replace-by-fee and absolute lock time but
/// disables relative lock time.
///
/// This sequence number has no meaning other than to enable RBF and the absolute locktime.
pub const ENABLE_LOCKTIME_AND_RBF: Self = Sequence(0xFFFFFFFD);

/// The number of bytes that a sequence number contributes to the size of a transaction.
pub const SIZE: usize = 4; // Serialized length of a u32.
Expand Down

0 comments on commit 0a83e53

Please sign in to comment.