units: Remove deprecated calls in absolute locktime code
What changed, and why it matters
This is a routine code cleanup inside test code only. It swaps deprecated function calls for newer, non-deprecated equivalents in a Rust unit test file. There is no change to production behavior, no bug fix, and no security relevance visible in the commit.
No security action needed. Treat as normal maintenance / lint suppression cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies units/src/locktime/relative/mod.rs, specifically the sanity_check unit test. It replaces direct calls to deprecated methods (NumberOfBlocks::MAX.to_consensus_u32, NumberOf512Seconds::value, NumberOf512Seconds::to_consensus_u32) with equivalent non-deprecated API calls (LockTime::from(…).to_consensus_u32, NumberOf512Seconds::to_512_second_intervals). Stats are +3/-3 in a single test file.
Changed components
units/src/locktime/relative/mod.rs (test module only)Inspect captured patch +3 / −3
diff --git a/units/src/locktime/relative/mod.rs b/units/src/locktime/relative/mod.rs
index 0d32181c..59667b02 100644
--- a/units/src/locktime/relative/mod.rs
+++ b/units/src/locktime/relative/mod.rs
@@ -866,10 +866,10 @@ mod tests {
#[test]
#[allow(deprecated_in_future)]
fn sanity_check() {
- assert_eq!(NumberOfBlocks::MAX.to_consensus_u32(), u32::from(u16::MAX));
- assert_eq!(NumberOf512Seconds::from_512_second_intervals(100).value(), 100u16);
+ assert_eq!(LockTime::from(NumberOfBlocks::MAX).to_consensus_u32(), u32::from(u16::MAX));
+ assert_eq!(NumberOf512Seconds::from_512_second_intervals(100).to_512_second_intervals(), 100u16);
assert_eq!(
- NumberOf512Seconds::from_512_second_intervals(100).to_consensus_u32(),
+ LockTime::from(NumberOf512Seconds::from_512_second_intervals(100)).to_consensus_u32(),
4_194_404u32
); // 0x400064
assert_eq!(NumberOf512Seconds::from_512_second_intervals(1).to_seconds(), 512);
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.