Skip to content

Commit

Permalink
Merge #1171: Remove MAX_SEQUENCE constant
Browse files Browse the repository at this point in the history
b6c5fc3 Remove MAX_SEQUENCE const (Tobin C. Harding)

Pull request description:

  This is follow up work to the recent addition of the `Sequence` type. We
  do not need to keep a public integer const for `MAX_SEQUENCE` because we
  offer the `Sequenc::MAX` associated type.

  Use the all-bits-set u64 directly in the associated type `Sequence::MAX`.

  cc nlanson

ACKs for top commit:
  Kixunil:
    ACK b6c5fc3
  apoelstra:
    ACK b6c5fc3

Tree-SHA512: c0acacc25d7cb2f8774e8c6dee8acb3faca0bf6cbd657054ea7262f26b4dfe8baaf2066662966dc507d26716c0468c97d09c590deec48ecd9d11a415ab2bf9ff
  • Loading branch information
apoelstra committed Aug 5, 2022
2 parents 9bac1a0 + b6c5fc3 commit 995c83c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/blockdata/constants.rs
Expand Up @@ -24,8 +24,6 @@ use crate::network::constants::Network;
use crate::util::uint::Uint256;
use crate::internal_macros::{impl_array_newtype, impl_bytes_newtype};

/// The maximum allowable sequence number
pub const MAX_SEQUENCE: u32 = 0xFFFFFFFF;
/// How many satoshis are in "one bitcoin"
pub const COIN_VALUE: u64 = 100_000_000;
/// How many seconds between blocks we expect on average
Expand Down
4 changes: 2 additions & 2 deletions src/blockdata/transaction.rs
Expand Up @@ -22,7 +22,7 @@ use crate::hashes::{self, Hash, sha256d};
use crate::hashes::hex::FromHex;

use crate::util::endian;
use crate::blockdata::constants::{WITNESS_SCALE_FACTOR, MAX_SEQUENCE};
use crate::blockdata::constants::WITNESS_SCALE_FACTOR;
#[cfg(feature="bitcoinconsensus")] use crate::blockdata::script;
use crate::blockdata::script::Script;
use crate::blockdata::witness::Witness;
Expand Down Expand Up @@ -264,7 +264,7 @@ impl Sequence {
/// The maximum allowable sequence number.
///
/// This sequence number disables lock-time and replace-by-fee.
pub const MAX: Self = Sequence(MAX_SEQUENCE);
pub const MAX: Self = Sequence(0xFFFFFFFF);
/// Zero value sequence.
///
/// This sequence number enables replace-by-fee and lock-time.
Expand Down

0 comments on commit 995c83c

Please sign in to comment.