Favour new function `from_mtp` over deprecated

Use the new function and not the deprecated on in rustdcos and tests.
This commit is contained in:
Tobin C. Harding 2025-05-12 12:29:33 +10:00
parent f9d6453d5b
commit 480a2cd62a
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
2 changed files with 4 additions and 4 deletions

View File

@ -64,7 +64,7 @@ fn serde_regression_absolute_lock_time_height() {
#[test]
fn serde_regression_absolute_lock_time_time() {
let seconds: u32 = 1653195600; // May 22nd, 5am UTC.
let t = absolute::LockTime::from_time(seconds).expect("valid time");
let t = absolute::LockTime::from_mtp(seconds).expect("valid time");
let got = serialize(&t).unwrap();
let want = include_bytes!("data/serde/absolute_lock_time_seconds_bincode") as &[_];

View File

@ -79,7 +79,7 @@ pub enum LockTime {
/// use bitcoin_primitives::absolute;
///
/// let seconds: u32 = 1653195600; // May 22nd, 5am UTC.
/// let n = absolute::LockTime::from_time(seconds).expect("valid time");
/// let n = absolute::LockTime::from_mtp(seconds).expect("valid time");
/// assert!(n.is_block_time());
/// assert_eq!(n.to_consensus_u32(), seconds);
/// ```
@ -197,8 +197,8 @@ impl LockTime {
///
/// ```rust
/// # use bitcoin_primitives::absolute;
/// assert!(absolute::LockTime::from_time(1653195600).is_ok());
/// assert!(absolute::LockTime::from_time(741521).is_err());
/// assert!(absolute::LockTime::from_mtp(1653195600).is_ok());
/// assert!(absolute::LockTime::from_mtp(741521).is_err());
/// ```
#[inline]
pub fn from_mtp(n: u32) -> Result<Self, ConversionError> {