Merge rust-bitcoin/rust-bitcoin#1171: Remove `MAX_SEQUENCE` constant

b6c5fc3622 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 b6c5fc3622
  apoelstra:
    ACK b6c5fc3622

Tree-SHA512: c0acacc25d7cb2f8774e8c6dee8acb3faca0bf6cbd657054ea7262f26b4dfe8baaf2066662966dc507d26716c0468c97d09c590deec48ecd9d11a415ab2bf9ff
This commit is contained in:
Andrew Poelstra 2022-08-05 14:39:59 +00:00
commit 995c83c38c
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
2 changed files with 2 additions and 4 deletions

View File

@ -24,8 +24,6 @@ use crate::network::constants::Network;
use crate::util::uint::Uint256; use crate::util::uint::Uint256;
use crate::internal_macros::{impl_array_newtype, impl_bytes_newtype}; 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" /// How many satoshis are in "one bitcoin"
pub const COIN_VALUE: u64 = 100_000_000; pub const COIN_VALUE: u64 = 100_000_000;
/// How many seconds between blocks we expect on average /// How many seconds between blocks we expect on average

View File

@ -22,7 +22,7 @@ use crate::hashes::{self, Hash, sha256d};
use crate::hashes::hex::FromHex; use crate::hashes::hex::FromHex;
use crate::util::endian; 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; #[cfg(feature="bitcoinconsensus")] use crate::blockdata::script;
use crate::blockdata::script::Script; use crate::blockdata::script::Script;
use crate::blockdata::witness::Witness; use crate::blockdata::witness::Witness;
@ -264,7 +264,7 @@ impl Sequence {
/// The maximum allowable sequence number. /// The maximum allowable sequence number.
/// ///
/// This sequence number disables lock-time and replace-by-fee. /// 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. /// Zero value sequence.
/// ///
/// This sequence number enables replace-by-fee and lock-time. /// This sequence number enables replace-by-fee and lock-time.