mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 05:18:30 +00:00
Retry custody requests after peer metadata updates (#6975)
Closes https://github.com/sigp/lighthouse/issues/6895 We need sync to retry custody requests when a peer CGC updates. A higher CGC can result in a data column subnet peer count increasing from 0 to 1, allowing requests to happen. Add new sync event `SyncMessage::UpdatedPeerCgc`. It's sent by the router when a metadata response updates the known CGC
This commit is contained in:
@@ -103,6 +103,8 @@ pub enum NetworkEvent<E: EthSpec> {
|
||||
StatusPeer(PeerId),
|
||||
NewListenAddr(Multiaddr),
|
||||
ZeroListeners,
|
||||
/// A peer has an updated custody group count from MetaData.
|
||||
PeerUpdatedCustodyGroupCount(PeerId),
|
||||
}
|
||||
|
||||
pub type Gossipsub = gossipsub::Behaviour<SnappyTransform, SubscriptionFilter>;
|
||||
@@ -1655,7 +1657,7 @@ impl<E: EthSpec> Network<E> {
|
||||
return None;
|
||||
}
|
||||
|
||||
// The METADATA and PING RPC responses are handled within the behaviour and not propagated
|
||||
// The PING RPC responses are handled within the behaviour and not propagated
|
||||
match event.message {
|
||||
Err(handler_err) => {
|
||||
match handler_err {
|
||||
@@ -1858,9 +1860,11 @@ impl<E: EthSpec> Network<E> {
|
||||
None
|
||||
}
|
||||
RpcSuccessResponse::MetaData(meta_data) => {
|
||||
self.peer_manager_mut()
|
||||
let updated_cgc = self
|
||||
.peer_manager_mut()
|
||||
.meta_data_response(&peer_id, meta_data.as_ref().clone());
|
||||
None
|
||||
// Send event after calling into peer_manager so the PeerDB is updated.
|
||||
updated_cgc.then(|| NetworkEvent::PeerUpdatedCustodyGroupCount(peer_id))
|
||||
}
|
||||
/* Network propagated protocols */
|
||||
RpcSuccessResponse::Status(msg) => {
|
||||
|
||||
Reference in New Issue
Block a user