What changed, and why it matters
This commit is a harmless code-quality cleanup. It swaps two bitwise AND operators (`&`) for logical AND operators (`&&`) in functions that check Bitcoin transaction sequence numbers. The author explicitly states there is no logic change. Because both operands are already boolean expressions, the result is identical; the only difference is that `&&` skips evaluating the second expression when the first is false, which is slightly more efficient.
No security action needed. Treat as a normal code-quality / lint-fix commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In units/src/sequence.rs, is_height_locked() and is_time_locked() previously combined two boolean results with &. The patch changes these to &&. Both sides of each operator are booleans (self.is_relative_lock_time() returns bool, and the parenthesized comparisons return bool), so the truth table is unchanged. The change enables short-circuit evaluation and satisfies the Clippy needless_bitwise_bool lint. There is no security-relevant behavior change.
Changed components
units/src/sequence.rsInspect captured patch +2 / −2
diff --git a/units/src/sequence.rs b/units/src/sequence.rs
index b7271e5d..5ea92124 100644
--- a/units/src/sequence.rs
+++ b/units/src/sequence.rs
@@ -114,13 +114,13 @@ impl Sequence {
/// Returns `true` if the sequence number encodes a block based relative lock-time.
#[inline]
pub fn is_height_locked(self) -> bool {
- self.is_relative_lock_time() & (self.0 & Self::LOCK_TYPE_MASK == 0)
+ self.is_relative_lock_time() && (self.0 & Self::LOCK_TYPE_MASK == 0)
}
/// Returns `true` if the sequence number encodes a time interval based relative lock-time.
#[inline]
pub fn is_time_locked(self) -> bool {
- self.is_relative_lock_time() & (self.0 & Self::LOCK_TYPE_MASK > 0)
+ self.is_relative_lock_time() && (self.0 & Self::LOCK_TYPE_MASK > 0)
}
/// Constructs a new `Sequence` from a prefixed hex string.
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.