Shorten locktime type term

Use lock-by-time and lock-by-height instead of lock-by-blocktime and
lock-by-blockheight respectively with no loss of clarity.
This commit is contained in:
Tobin C. Harding 2025-05-12 12:26:06 +10:00
parent 727047bd39
commit f9d6453d5b
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
5 changed files with 12 additions and 12 deletions

View File

@ -32,7 +32,7 @@ pub mod locktime {
pub mod absolute {
//! Provides type [`LockTime`] that implements the logic around nLockTime/OP_CHECKLOCKTIMEVERIFY.
//!
//! There are two types of lock time: lock-by-blockheight and lock-by-blocktime, distinguished by
//! There are two types of lock time: lock-by-height and lock-by-time, distinguished by
//! whether `LockTime < LOCKTIME_THRESHOLD`.
use io::{BufRead, Write};
@ -66,7 +66,7 @@ pub mod locktime {
pub mod relative {
//! Provides type [`LockTime`] that implements the logic around nSequence/OP_CHECKSEQUENCEVERIFY.
//!
//! There are two types of lock time: lock-by-blockheight and lock-by-blocktime, distinguished by
//! There are two types of lock time: lock-by-height and lock-by-time, distinguished by
//! whether bit 22 of the `u32` consensus value is set.
/// Re-export everything from the `primitives::locktime::relative` module.

View File

@ -2,7 +2,7 @@
//! Provides type [`LockTime`] that implements the logic around `nLockTime`/`OP_CHECKLOCKTIMEVERIFY`.
//!
//! There are two types of lock time: lock-by-blockheight and lock-by-blocktime, distinguished by
//! There are two types of lock time: lock-by-height and lock-by-time, distinguished by
//! whether `LockTime < LOCKTIME_THRESHOLD`.
use core::fmt;

View File

@ -2,7 +2,7 @@
//! Provides type [`LockTime`] that implements the logic around `nSequence`/`OP_CHECKSEQUENCEVERIFY`.
//!
//! There are two types of lock time: lock-by-blockheight and lock-by-blocktime, distinguished by
//! There are two types of lock time: lock-by-height and lock-by-time, distinguished by
//! whether bit 22 of the `u32` consensus value is set.
use core::{convert, fmt};

View File

@ -349,7 +349,7 @@ impl std::error::Error for ConversionError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
}
/// Describes the two types of locking, lock-by-blockheight and lock-by-blocktime.
/// Describes the two types of locking, lock-by-height and lock-by-time.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
enum LockTimeUnit {
/// Lock by blockheight.
@ -364,9 +364,9 @@ impl fmt::Display for LockTimeUnit {
match *self {
L::Blocks =>
write!(f, "expected lock-by-blockheight (must be < {})", LOCK_TIME_THRESHOLD),
write!(f, "expected lock-by-height (must be < {})", LOCK_TIME_THRESHOLD),
L::Seconds =>
write!(f, "expected lock-by-blocktime (must be >= {})", LOCK_TIME_THRESHOLD),
write!(f, "expected lock-by-time (must be >= {})", LOCK_TIME_THRESHOLD),
}
}
}
@ -580,8 +580,8 @@ mod tests {
let blocks = LockTimeUnit::Blocks;
let seconds = LockTimeUnit::Seconds;
assert_eq!(format!("{}", blocks), "expected lock-by-blockheight (must be < 500000000)");
assert_eq!(format!("{}", seconds), "expected lock-by-blocktime (must be >= 500000000)");
assert_eq!(format!("{}", blocks), "expected lock-by-height (must be < 500000000)");
assert_eq!(format!("{}", seconds), "expected lock-by-time (must be >= 500000000)");
}
#[test]

View File

@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize};
#[doc(hidden)]
pub type Height = NumberOfBlocks;
/// A relative lock time lock-by-blockheight value.
/// A relative lock time lock-by-height value.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct NumberOfBlocks(u16);
@ -94,9 +94,9 @@ impl fmt::Display for NumberOfBlocks {
#[doc(hidden)]
pub type Time = NumberOf512Seconds;
/// A relative lock time lock-by-blocktime value.
/// A relative lock time lock-by-time value.
///
/// For BIP 68 relative lock-by-blocktime locks, time is measured in 512 second intervals.
/// For BIP 68 relative lock-by-time locks, time is measured in 512 second intervals.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct NumberOf512Seconds(u16);