mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Add error message for duration subtraction overflow in sim tests (#6558)
* Add error message for duration subtraction overflow.
This commit is contained in:
@@ -459,7 +459,7 @@ impl<E: EthSpec> LocalNetwork<E> {
|
||||
.map(|body| body.unwrap().data.finalized.epoch)
|
||||
}
|
||||
|
||||
pub async fn duration_to_genesis(&self) -> Duration {
|
||||
pub async fn duration_to_genesis(&self) -> Result<Duration, &'static str> {
|
||||
let nodes = self.remote_nodes().expect("Failed to get remote nodes");
|
||||
let bootnode = nodes.first().expect("Should contain bootnode");
|
||||
let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
|
||||
@@ -471,6 +471,9 @@ impl<E: EthSpec> LocalNetwork<E> {
|
||||
.data
|
||||
.genesis_time,
|
||||
);
|
||||
genesis_time - now
|
||||
genesis_time.checked_sub(now).ok_or(
|
||||
"The genesis time has already passed since all nodes started. The node startup time \
|
||||
may have regressed, and the current `GENESIS_DELAY` is no longer sufficient.",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user