Do not request attestation data when attestation duty is empty (#8559)

Co-Authored-By: Tan Chee Keong <tanck@sigmaprime.io>
This commit is contained in:
chonghe
2025-12-11 14:56:53 +08:00
committed by GitHub
parent d9ddb72f5b
commit 5abbdb660a

View File

@@ -193,6 +193,12 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> AttestationService<S,
// Create and publish an `Attestation` for all validators only once
// as the committee_index is not included in AttestationData post-Electra
let attestation_duties: Vec<_> = self.duties_service.attesters(slot).into_iter().collect();
// Return early if there is no attestation duties
if attestation_duties.is_empty() {
return Ok(());
}
let attestation_service = self.clone();
let attestation_data_handle = self
@@ -371,10 +377,6 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> AttestationService<S,
&[validator_metrics::ATTESTATIONS],
);
if validator_duties.is_empty() {
return Ok(());
}
let current_epoch = self
.slot_clock
.now()