From a19fdd9f254044b51e1e99c091a5dd347d41cdd8 Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 15 Jul 2020 16:34:58 +1000 Subject: [PATCH] fix: Rename to is_time_valid_at --- zebra-chain/src/block/header.rs | 2 +- zebra-chain/src/block/tests.rs | 8 ++++---- zebra-consensus/src/block.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/zebra-chain/src/block/header.rs b/zebra-chain/src/block/header.rs index a6da4b90d..332b93210 100644 --- a/zebra-chain/src/block/header.rs +++ b/zebra-chain/src/block/header.rs @@ -96,7 +96,7 @@ impl BlockHeader { /// accepted." [ยง7.5][7.5] /// /// [7.5]: https://zips.z.cash/protocol/protocol.pdf#blockheader - pub fn is_time_valid_local_clock(&self, now: DateTime) -> Result<(), Error> { + pub fn is_time_valid_at(&self, now: DateTime) -> Result<(), Error> { let two_hours_in_the_future = now .checked_add_signed(Duration::hours(2)) .ok_or("overflow when calculating 2 hours in the future")?; diff --git a/zebra-chain/src/block/tests.rs b/zebra-chain/src/block/tests.rs index eb357c367..7556fad5f 100644 --- a/zebra-chain/src/block/tests.rs +++ b/zebra-chain/src/block/tests.rs @@ -250,18 +250,18 @@ fn time_check_past_block() { // fail. block .header - .is_time_valid_local_clock(now) + .is_time_valid_at(now) .expect("the header time from a mainnet block should be valid"); } -/// Test wrapper for `BlockHeader.is_time_valid_local_clock`. +/// Test wrapper for `BlockHeader.is_time_valid_at`. /// /// Generates a block header, sets its `time` to `block_header_time`, then -/// calls `is_time_valid_local_clock`. +/// calls `is_time_valid_at`. fn node_time_check(block_header_time: DateTime, now: DateTime) -> Result<(), Error> { let mut header = generate::block_header(); header.time = block_header_time; - header.is_time_valid_local_clock(now) + header.is_time_valid_at(now) } #[test] diff --git a/zebra-consensus/src/block.rs b/zebra-consensus/src/block.rs index 3bb662c26..dfb8b3e9d 100644 --- a/zebra-consensus/src/block.rs +++ b/zebra-consensus/src/block.rs @@ -67,7 +67,7 @@ where // quick checks first. let now = Utc::now(); - block.header.is_time_valid_local_clock(now)?; + block.header.is_time_valid_at(now)?; block.header.is_equihash_solution_valid()?; block.is_coinbase_first()?;