Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/client/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl<N: NetworkSpec, C: Consensus<N::BlockResponse>, E: ExecutionProvider<N>> No
async fn check_head_age(&self) -> Result<(), ClientError> {
let timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_else(|_| panic!("unreachable"))
.unwrap_or_default()
.as_secs();

let tag = BlockNumberOrTag::Latest.into();
Expand Down
5 changes: 1 addition & 4 deletions ethereum/consensus-core/src/consensus_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,7 @@ pub fn force_update<S: ConsensusSpec>(store: &mut LightClientStore<S>, current_s
}

pub fn expected_current_slot(now: SystemTime, genesis_time: u64) -> u64 {
let now = now
.duration_since(UNIX_EPOCH)
.unwrap_or_else(|_| panic!("unreachable"))
.as_secs();
let now = now.duration_since(UNIX_EPOCH).unwrap_or_default().as_secs();

let since_genesis = now - genesis_time;

Expand Down
6 changes: 3 additions & 3 deletions ethereum/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ impl<S: ConsensusSpec, R: ConsensusRpc<S>> Inner<S, R> {

let now = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_else(|_| panic!("unreachable"))
.unwrap_or_default()
.as_secs();

let time_to_next_slot = next_slot_timestamp - now;
Expand Down Expand Up @@ -577,9 +577,9 @@ impl<S: ConsensusSpec, R: ConsensusRpc<S>> Inner<S, R> {
let expected_time = self.slot_timestamp(slot);
let now = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_else(|_| panic!("unreachable"));
.unwrap_or_default();

let delay = now - std::time::Duration::from_secs(expected_time);
let delay = now.saturating_sub(std::time::Duration::from_secs(expected_time));
chrono::Duration::from_std(delay).unwrap()
}

Expand Down
2 changes: 1 addition & 1 deletion linea/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl Inner {
{
let now = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_else(|_| panic!("unreachable"));
.unwrap_or_default();

let timestamp = Duration::from_secs(block.header.timestamp);
let age = now.saturating_sub(timestamp);
Expand Down
2 changes: 1 addition & 1 deletion opstack/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl Inner {
{
let now = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_else(|_| panic!("unreachable"));
.unwrap_or_default();

let timestamp = Duration::from_secs(payload.timestamp);
let age = now.saturating_sub(timestamp);
Expand Down
Loading