@@ -42,8 +42,6 @@ use common_types::{
42
42
verification:: Unverified ,
43
43
} ;
44
44
45
- use time_utils:: CheckedSystemTime ;
46
-
47
45
/// Phase 1 quick block verification. Only does checks that are cheap. Operates on a single block
48
46
pub fn verify_block_basic ( block : & Unverified , engine : & dyn Engine , check_seal : bool ) -> Result < ( ) , Error > {
49
47
verify_header_params ( & block. header , engine, check_seal) ?;
@@ -341,7 +339,7 @@ pub(crate) fn verify_header_time(header: &Header) -> Result<(), Error> {
341
339
// this will resist overflow until `year 2037`
342
340
let max_time = SystemTime :: now ( ) + ACCEPTABLE_DRIFT ;
343
341
let invalid_threshold = max_time + ACCEPTABLE_DRIFT * 9 ;
344
- let timestamp = CheckedSystemTime :: checked_add ( UNIX_EPOCH , Duration :: from_secs ( header. timestamp ( ) ) )
342
+ let timestamp = UNIX_EPOCH . checked_add ( Duration :: from_secs ( header. timestamp ( ) ) )
345
343
. ok_or ( BlockError :: TimestampOverflow ) ?;
346
344
347
345
if timestamp > invalid_threshold {
@@ -370,9 +368,9 @@ fn verify_parent(header: &Header, parent: &Header, engine: &dyn Engine) -> Resul
370
368
371
369
if !engine. is_timestamp_valid ( header. timestamp ( ) , parent. timestamp ( ) ) {
372
370
let now = SystemTime :: now ( ) ;
373
- let min = CheckedSystemTime :: checked_add ( now , Duration :: from_secs ( parent. timestamp ( ) . saturating_add ( 1 ) ) )
371
+ let min = now . checked_add ( Duration :: from_secs ( parent. timestamp ( ) . saturating_add ( 1 ) ) )
374
372
. ok_or ( BlockError :: TimestampOverflow ) ?;
375
- let found = CheckedSystemTime :: checked_add ( now , Duration :: from_secs ( header. timestamp ( ) ) )
373
+ let found = now . checked_add ( Duration :: from_secs ( header. timestamp ( ) ) )
376
374
. ok_or ( BlockError :: TimestampOverflow ) ?;
377
375
return Err ( From :: from ( BlockError :: InvalidTimestamp ( OutOfBounds { max : None , min : Some ( min) , found } . into ( ) ) ) )
378
376
}
0 commit comments