fix: Rename to is_time_valid_at

This commit is contained in:
teor 2020-07-15 16:34:58 +10:00 committed by Henry de Valence
parent b2bb872df0
commit a19fdd9f25
3 changed files with 6 additions and 6 deletions

View File

@ -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<Utc>) -> Result<(), Error> {
pub fn is_time_valid_at(&self, now: DateTime<Utc>) -> 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")?;

View File

@ -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<Utc>, now: DateTime<Utc>) -> 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]

View File

@ -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()?;