Merge rust-bitcoin/rust-bitcoin#3439: sequence: clarify sequence constant name and add FINAL

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

Pull request description:

  c24630e7b13312ea34f0f54ed832783ced8dde3f
  - `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.

  9cc5dfeef178f03ea4d0786cfbaa3b8709fed644
  - 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 4499b5c95b
  apoelstra:
    ACK 4499b5c95b successfully ran local tests

Tree-SHA512: dbea5ae911556d53025078e7193f0972d5e8ba354f69692091b2b05cc441e270f25eafa55b144a6970de42d8f596a2b0103cdee463c3126d5d9986cee88ce8fc
This commit is contained in:
merge-script 2024-10-08 02:46:11 +00:00
commit 0a83e5336d
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 12 additions and 1 deletions

View File

@ -38,18 +38,29 @@ pub struct Sequence(pub u32);
impl Sequence { impl Sequence {
/// The maximum allowable sequence number. /// 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); pub const MAX: Self = Sequence(0xFFFFFFFF);
/// Zero value sequence. /// Zero value sequence.
/// ///
/// This sequence number enables replace-by-fee and absolute lock time. /// This sequence number enables replace-by-fee and absolute lock time.
pub const ZERO: Self = Sequence(0); 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 /// The sequence number that enables absolute lock time but disables replace-by-fee
/// and relative lock time. /// and relative lock time.
pub const ENABLE_LOCKTIME_NO_RBF: Self = Sequence::MIN_NO_RBF; pub const ENABLE_LOCKTIME_NO_RBF: Self = Sequence::MIN_NO_RBF;
/// The sequence number that enables replace-by-fee and absolute lock time but /// The sequence number that enables replace-by-fee and absolute lock time but
/// disables relative lock time. /// 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); 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. /// 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. pub const SIZE: usize = 4; // Serialized length of a u32.