Skip to content

Commit 110c4cc

Browse files
committed
fix
1 parent 39c5411 commit 110c4cc

File tree

1 file changed

+44
-40
lines changed

1 file changed

+44
-40
lines changed

beacon_node/network/src/network_beacon_processor/gossip_methods.rs

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -469,46 +469,50 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
469469
// Outermost error (from `with_committee_cache`) indicating that the block is not known
470470
// and that this conversion should be retried.
471471
Err(BeaconChainError::MissingBeaconBlock(beacon_block_root)) => {
472-
metrics::inc_counter(
473-
&metrics::BEACON_PROCESSOR_UNAGGREGATED_ATTESTATION_REQUEUED_TOTAL,
474-
);
475-
// We don't know the block, get the sync manager to handle the block lookup, and
476-
// send the attestation to be scheduled for re-processing.
477-
self.sync_tx
478-
.send(SyncMessage::UnknownBlockHashFromAttestation(
479-
peer_id,
480-
beacon_block_root,
481-
))
482-
.unwrap_or_else(|_| {
483-
warn!(msg = "UnknownBlockHash", "Failed to send to sync service")
484-
});
485-
let processor = self.clone();
486-
let msg_id = message_id.clone();
487-
// Do not allow this attestation to be re-processed beyond this point.
488-
let reprocess_msg =
489-
ReprocessQueueMessage::UnknownBlockUnaggregate(QueuedUnaggregate {
490-
beacon_block_root,
491-
process_fn: Box::new(move || {
492-
processor.process_gossip_attestation_to_convert(
493-
msg_id,
494-
peer_id,
495-
single_attestation,
496-
subnet_id,
497-
should_import,
498-
false,
499-
seen_timestamp,
500-
)
501-
}),
502-
});
503-
if self
504-
.beacon_processor_send
505-
.try_send(WorkEvent {
506-
drop_during_sync: false,
507-
work: Work::Reprocess(reprocess_msg),
508-
})
509-
.is_err()
510-
{
511-
error!("Failed to send attestation for re-processing");
472+
if should_reprocess {
473+
metrics::inc_counter(
474+
&metrics::BEACON_PROCESSOR_UNAGGREGATED_ATTESTATION_REQUEUED_TOTAL,
475+
);
476+
477+
// We don't know the block, get the sync manager to handle the block lookup, and
478+
// send the attestation to be scheduled for re-processing.
479+
self.sync_tx
480+
.send(SyncMessage::UnknownBlockHashFromAttestation(
481+
peer_id,
482+
beacon_block_root,
483+
))
484+
.unwrap_or_else(|_| {
485+
warn!(msg = "UnknownBlockHash", "Failed to send to sync service")
486+
});
487+
let processor = self.clone();
488+
let msg_id = message_id.clone();
489+
// Do not allow this attestation to be re-processed beyond this point.
490+
let reprocess_msg =
491+
ReprocessQueueMessage::UnknownBlockUnaggregate(QueuedUnaggregate {
492+
beacon_block_root,
493+
process_fn: Box::new(move || {
494+
processor.process_gossip_attestation_to_convert(
495+
msg_id,
496+
peer_id,
497+
single_attestation,
498+
subnet_id,
499+
should_import,
500+
false,
501+
seen_timestamp,
502+
)
503+
}),
504+
});
505+
if self
506+
.beacon_processor_send
507+
.try_send(WorkEvent {
508+
drop_during_sync: false,
509+
work: Work::Reprocess(reprocess_msg),
510+
})
511+
.is_err()
512+
{
513+
error!("Failed to send attestation for re-processing");
514+
}
515+
} else {
512516
// We shouldn't make any further attempts to process this attestation.
513517
//
514518
// Don't downscore the peer since it's not clear if we requested this head

0 commit comments

Comments
 (0)