From c707b959b72dd89ca6df581a6102f32daedb8368 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Sat, 8 Mar 2025 08:30:10 +1100 Subject: [PATCH] Rename timestamp module to time We just re-named `Timestamp` to `BlockTime`. We have a `units::block` module but it currently holds abstractions (`BlockHeight` and `BlockInterval`) that are not onchain abstractions and therefore somewhat different from the `BlockTime`. Instead of making `block` a block 'utils' module instead re-name the `timestamp` module to `time`. --- bitcoin/src/lib.rs | 2 +- primitives/src/lib.rs | 2 +- units/src/lib.rs | 4 ++-- units/src/{timestamp.rs => time.rs} | 0 units/tests/api.rs | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) rename units/src/{timestamp.rs => time.rs} (100%) diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs index e9505f8af..792f23df1 100644 --- a/bitcoin/src/lib.rs +++ b/bitcoin/src/lib.rs @@ -135,7 +135,7 @@ pub use units::{ amount::{Amount, Denomination, SignedAmount}, block::{BlockHeight, BlockInterval}, fee_rate::FeeRate, - timestamp::{self, BlockTime}, + time::{self, BlockTime}, weight::Weight, }; diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index b26727e0f..31fb210a8 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -58,7 +58,7 @@ pub use units::{ amount::{self, Amount, SignedAmount}, block::{BlockHeight, BlockInterval}, fee_rate::{self, FeeRate}, - timestamp::{self, BlockTime}, + time::{self, BlockTime}, weight::{self, Weight}, }; diff --git a/units/src/lib.rs b/units/src/lib.rs index 287005c45..4a166ebb2 100644 --- a/units/src/lib.rs +++ b/units/src/lib.rs @@ -34,7 +34,7 @@ pub mod block; pub mod fee_rate; pub mod locktime; pub mod parse; -pub mod timestamp; +pub mod time; pub mod weight; #[doc(inline)] @@ -43,6 +43,6 @@ pub use self::{ amount::{Amount, SignedAmount}, block::{BlockHeight, BlockInterval}, fee_rate::FeeRate, - timestamp::BlockTime, + time::BlockTime, weight::Weight }; diff --git a/units/src/timestamp.rs b/units/src/time.rs similarity index 100% rename from units/src/timestamp.rs rename to units/src/time.rs diff --git a/units/tests/api.rs b/units/tests/api.rs index 9643fb8be..b8ec96c3c 100644 --- a/units/tests/api.rs +++ b/units/tests/api.rs @@ -141,7 +141,7 @@ struct Errors { #[test] fn api_can_use_modules_from_crate_root() { - use bitcoin_units::{amount, block, fee_rate, locktime, parse, timestamp, weight}; + use bitcoin_units::{amount, block, fee_rate, locktime, parse, time, weight}; } #[test] @@ -189,8 +189,8 @@ fn api_can_use_all_types_from_module_parse() { } #[test] -fn api_can_use_all_types_from_module_timestamp() { - use bitcoin_units::timestamp::BlockTime; +fn api_can_use_all_types_from_module_time() { + use bitcoin_units::time::BlockTime; } #[test]