mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 05:44:44 +00:00
Return ResourceUnavailable if we are unable to reconstruct execution payloads (#3365)
## Issue Addressed Resolves #3351 ## Proposed Changes Returns a `ResourceUnavailable` rpc error if we are unable to serve full payloads to blocks by root and range requests because the execution layer is not synced. ## Additional Info This PR also changes the penalties such that a `ResourceUnavailable` error is only penalized if it is an outgoing request. If we are syncing and aren't getting full block responses, then we don't have use for the peer. However, this might not be true for the incoming request case. We let the peer decide in this case if we are still useful or if we should be banned. cc @divagant-martian please let me know if i'm missing something here.
This commit is contained in:
@@ -481,7 +481,15 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
|
||||
// implement a new sync type which tracks these peers and prevents the sync
|
||||
// algorithms from requesting blocks from them (at least for a set period of
|
||||
// time, multiple failures would then lead to a ban).
|
||||
PeerAction::Fatal
|
||||
|
||||
match direction {
|
||||
// If the blocks request was initiated by us, then we have no use of this
|
||||
// peer and so we ban it.
|
||||
ConnectionDirection::Outgoing => PeerAction::Fatal,
|
||||
// If the blocks request was initiated by the peer, then we let the peer decide if
|
||||
// it wants to continue talking to us, we do not ban the peer.
|
||||
ConnectionDirection::Incoming => return,
|
||||
}
|
||||
}
|
||||
RPCResponseErrorCode::ServerError => PeerAction::MidToleranceError,
|
||||
RPCResponseErrorCode::InvalidRequest => PeerAction::LowToleranceError,
|
||||
|
||||
Reference in New Issue
Block a user