Refactor timestamp_now (#9094)

#9077


  Where possible replaces all instances of `validator_monitor::timestamp_now` with `chain.slot_clock.now_duration().unwrap_or_default()`.
Where chain/slot_clock is not available, instead replace it with a convenience function `slot_clock::timestamp_now`.
Remove the `validator_monitor::timestamp_now` function.


Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
Mac L
2026-04-09 12:41:02 +04:00
committed by GitHub
parent fb5a0434d7
commit 7c2dcfc0d6
12 changed files with 60 additions and 60 deletions

View File

@@ -35,15 +35,13 @@
//! appears that this validator is capable of producing valid
//! attestations and there's no immediate cause for concern.
use crate::task_spawner::{Priority, TaskSpawner};
use beacon_chain::{
AttestationError, BeaconChain, BeaconChainError, BeaconChainTypes,
validator_monitor::timestamp_now,
};
use beacon_chain::{AttestationError, BeaconChain, BeaconChainError, BeaconChainTypes};
use beacon_processor::work_reprocessing_queue::{QueuedUnaggregate, ReprocessQueueMessage};
use beacon_processor::{Work, WorkEvent};
use eth2::types::Failure;
use lighthouse_network::PubsubMessage;
use network::NetworkMessage;
use slot_clock::SlotClock;
use std::sync::Arc;
use std::time::Duration;
use tokio::sync::{mpsc::UnboundedSender, oneshot};
@@ -138,7 +136,7 @@ pub async fn publish_attestations<T: BeaconChainTypes>(
.collect::<Vec<_>>();
// Gossip validate and publish attestations that can be immediately processed.
let seen_timestamp = timestamp_now();
let seen_timestamp = chain.slot_clock.now_duration().unwrap_or_default();
let mut prelim_results = task_spawner
.clone()
.blocking_task(Priority::P0, move || {