units: Use uniform whitespace in consts
What changed, and why it matters
This commit only adds or removes blank lines between constant definitions in four source files to make the code style consistent. It does not change any program logic, values, or behavior, so it has no security relevance.
No action required; this is a non-functional style cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff is a pure whitespace/formatting change: it inserts blank lines between associated constants in units/src/amount/signed.rs, units/src/amount/unsigned.rs, units/src/pow.rs, and units/src/sequence.rs. No constants are added, removed, renamed, or reordered, and no values or access modifiers are altered. There is no executable or semantic change.
Changed components
Inspect captured patch +18 / −0
diff --git a/units/src/amount/signed.rs b/units/src/amount/signed.rs
index edf87498..97810396 100644
--- a/units/src/amount/signed.rs
+++ b/units/src/amount/signed.rs
@@ -55,6 +55,7 @@ mod encapsulate {
impl SignedAmount {
/// The maximum value of an amount.
pub const MAX: Self = Self(21_000_000 * 100_000_000);
+
/// The minimum value of an amount.
pub const MIN: Self = Self(-21_000_000 * 100_000_000);
@@ -103,12 +104,16 @@ use internals::const_casts;
impl SignedAmount {
/// The zero amount.
pub const ZERO: Self = Self::from_sat_i32(0);
+
/// Exactly one satoshi.
pub const ONE_SAT: Self = Self::from_sat_i32(1);
+
/// Exactly one bitcoin.
pub const ONE_BTC: Self = Self::from_btc_i16(1);
+
/// Exactly fifty bitcoin.
pub const FIFTY_BTC: Self = Self::from_btc_i16(50);
+
/// The maximum value allowed as an amount. Useful for sanity checking.
pub const MAX_MONEY: Self = Self::MAX;
diff --git a/units/src/amount/unsigned.rs b/units/src/amount/unsigned.rs
index 1258f0ec..cf6d0adb 100644
--- a/units/src/amount/unsigned.rs
+++ b/units/src/amount/unsigned.rs
@@ -60,6 +60,7 @@ mod encapsulate {
impl Amount {
/// The maximum value of an amount.
pub const MAX: Self = Self(21_000_000 * 100_000_000);
+
/// The minimum value of an amount.
pub const MIN: Self = Self(0);
@@ -105,14 +106,19 @@ pub use encapsulate::Amount;
impl Amount {
/// The zero amount.
pub const ZERO: Self = Self::from_sat_u32(0);
+
/// Exactly one satoshi.
pub const ONE_SAT: Self = Self::from_sat_u32(1);
+
/// Exactly one bitcoin.
pub const ONE_BTC: Self = Self::from_btc_u16(1);
+
/// Exactly fifty bitcoin.
pub const FIFTY_BTC: Self = Self::from_btc_u16(50);
+
/// The maximum value allowed as an amount. Useful for sanity checking.
pub const MAX_MONEY: Self = Self::MAX;
+
/// The number of bytes that an amount contributes to the size of a transaction.
pub const SIZE: usize = 8; // Serialized length of a u64.
diff --git a/units/src/pow.rs b/units/src/pow.rs
index 1955ddb7..4e3974c6 100644
--- a/units/src/pow.rs
+++ b/units/src/pow.rs
@@ -134,6 +134,7 @@ pub struct Target(U256);
impl Target {
/// When parsing nBits, Bitcoin Core converts a negative target threshold into a target of zero.
pub const ZERO: Self = Self(U256::ZERO);
+
/// The maximum possible target.
///
/// This value is used to calculate difficulty, which is defined as how difficult the current
diff --git a/units/src/sequence.rs b/units/src/sequence.rs
index 49b7ce07..fdb971be 100644
--- a/units/src/sequence.rs
+++ b/units/src/sequence.rs
@@ -40,15 +40,19 @@ impl Sequence {
///
/// The sequence number that disables replace-by-fee, absolute lock time and relative lock time.
pub const MAX: Self = Self(0xFFFF_FFFF);
+
/// Zero value sequence.
///
/// This sequence number enables replace-by-fee and absolute lock time.
pub const ZERO: Self = Self(0);
+
/// The sequence number that disables replace-by-fee, absolute lock time and relative lock time.
pub const FINAL: Self = Self::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 = Self::MIN_NO_RBF;
+
/// The maximum sequence number that enables replace-by-fee and absolute lock time but
/// disables relative lock time.
///
@@ -66,8 +70,10 @@ impl Sequence {
///
/// [BIP-0125]: <https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki>
const MIN_NO_RBF: Self = Self(0xFFFF_FFFE);
+
/// BIP-0068 relative lock time disable flag mask.
const LOCK_TIME_DISABLE_FLAG_MASK: u32 = 0x8000_0000;
+
/// BIP-0068 relative lock time type flag mask.
pub(super) const LOCK_TYPE_MASK: u32 = 0x0040_0000;
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.