fix: Rename to is_time_valid_at
This commit is contained in:
parent
b2bb872df0
commit
a19fdd9f25
|
@ -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")?;
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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()?;
|
||||
|
||||
|
|
Loading…
Reference in New Issue