mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 18:21:45 +00:00
Add block ban flag --invalid-block-roots (#7042)
This commit is contained in:
@@ -1457,6 +1457,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
| Err(e @ BlockError::InconsistentFork(_))
|
||||
| Err(e @ BlockError::ExecutionPayloadError(_))
|
||||
| Err(e @ BlockError::ParentExecutionPayloadInvalid { .. })
|
||||
| Err(e @ BlockError::KnownInvalidExecutionPayload(_))
|
||||
| Err(e @ BlockError::GenesisBlock) => {
|
||||
warn!(self.log, "Could not verify block for gossip. Rejecting the block";
|
||||
"error" => %e);
|
||||
|
||||
@@ -800,6 +800,18 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
peer_action: Some(PeerAction::LowToleranceError),
|
||||
})
|
||||
}
|
||||
// Penalise peers for sending us banned blocks.
|
||||
BlockError::KnownInvalidExecutionPayload(block_root) => {
|
||||
warn!(
|
||||
self.log,
|
||||
"Received block known to be invalid";
|
||||
"block_root" => ?block_root,
|
||||
);
|
||||
Err(ChainSegmentFailed {
|
||||
message: format!("Banned block: {block_root:?}"),
|
||||
peer_action: Some(PeerAction::Fatal),
|
||||
})
|
||||
}
|
||||
other => {
|
||||
debug!(
|
||||
self.log, "Invalid block received";
|
||||
|
||||
Reference in New Issue
Block a user