Function cuprate_helper::map::u64_to_timelock
source · pub const fn u64_to_timelock(u: u64) -> Timelock
Expand description
Height/time is not differentiated via type, but rather:
“height is any value less than 500_000_000
and timestamp is any value above”
so the u64/usize
is stored without any tag.
See timelock_to_u64
for the inverse function.
- https://github.com/Cuprate/cuprate/pull/102#discussion_r1558504285
- https://github.com/serai-dex/serai/blob/bc1dec79917d37d326ac3d9bc571a64131b0424a/coins/monero/src/transaction.rs#L139
assert_eq!(u64_to_timelock(0), Timelock::None);
assert_eq!(u64_to_timelock(499_999_999), Timelock::Block(499_999_999));
assert_eq!(u64_to_timelock(500_000_000), Timelock::Time(500_000_000));