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:
parent
f9d6453d5b
commit
480a2cd62a
|
@ -64,7 +64,7 @@ fn serde_regression_absolute_lock_time_height() {
|
||||||
#[test]
|
#[test]
|
||||||
fn serde_regression_absolute_lock_time_time() {
|
fn serde_regression_absolute_lock_time_time() {
|
||||||
let seconds: u32 = 1653195600; // May 22nd, 5am UTC.
|
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 got = serialize(&t).unwrap();
|
||||||
|
|
||||||
let want = include_bytes!("data/serde/absolute_lock_time_seconds_bincode") as &[_];
|
let want = include_bytes!("data/serde/absolute_lock_time_seconds_bincode") as &[_];
|
||||||
|
|
|
@ -79,7 +79,7 @@ pub enum LockTime {
|
||||||
/// use bitcoin_primitives::absolute;
|
/// use bitcoin_primitives::absolute;
|
||||||
///
|
///
|
||||||
/// let seconds: u32 = 1653195600; // May 22nd, 5am UTC.
|
/// 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!(n.is_block_time());
|
||||||
/// assert_eq!(n.to_consensus_u32(), seconds);
|
/// assert_eq!(n.to_consensus_u32(), seconds);
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -197,8 +197,8 @@ impl LockTime {
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # use bitcoin_primitives::absolute;
|
/// # use bitcoin_primitives::absolute;
|
||||||
/// assert!(absolute::LockTime::from_time(1653195600).is_ok());
|
/// assert!(absolute::LockTime::from_mtp(1653195600).is_ok());
|
||||||
/// assert!(absolute::LockTime::from_time(741521).is_err());
|
/// assert!(absolute::LockTime::from_mtp(741521).is_err());
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn from_mtp(n: u32) -> Result<Self, ConversionError> {
|
pub fn from_mtp(n: u32) -> Result<Self, ConversionError> {
|
||||||
|
|
Loading…
Reference in New Issue