mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 12:58:31 +00:00
Subscribe to core topics after sync (#1613)
## Issue Addressed N/A ## Proposed Changes Prevent subscribing to core gossipsub topics until after we have achieved a full sync. This prevents us censoring gossipsub channels, getting penalised in gossipsub 1.1 scoring and saves us computation time in attempting to validate gossipsub messages which we will be unable to do with a non-sync'd chain.
This commit is contained in:
@@ -98,8 +98,8 @@ impl<T: BeaconChainTypes> RangeSync<T> {
|
||||
/// On re-status, a peer that has no head to download indicates that this state can be set to
|
||||
/// idle as there are in fact no head chains to download. This function notifies the chain
|
||||
/// collection that the state can safely be set to idle.
|
||||
pub fn fully_synced_peer_found(&mut self) {
|
||||
self.chains.fully_synced_peer_found()
|
||||
pub fn fully_synced_peer_found(&mut self, network: &mut SyncNetworkContext<T::EthSpec>) {
|
||||
self.chains.fully_synced_peer_found(network)
|
||||
}
|
||||
|
||||
/// A useful peer has been added. The SyncManager has identified this peer as needing either
|
||||
@@ -168,7 +168,7 @@ impl<T: BeaconChainTypes> RangeSync<T> {
|
||||
// check if the new peer's addition will favour a new syncing chain.
|
||||
self.chains.update(network);
|
||||
// update the global sync state if necessary
|
||||
self.chains.update_sync_state();
|
||||
self.chains.update_sync_state(network);
|
||||
} else {
|
||||
// there is no finalized chain that matches this peer's last finalized target
|
||||
// create a new finalized chain
|
||||
@@ -183,7 +183,7 @@ impl<T: BeaconChainTypes> RangeSync<T> {
|
||||
);
|
||||
self.chains.update(network);
|
||||
// update the global sync state
|
||||
self.chains.update_sync_state();
|
||||
self.chains.update_sync_state(network);
|
||||
}
|
||||
}
|
||||
RangeSyncType::Head => {
|
||||
@@ -229,7 +229,7 @@ impl<T: BeaconChainTypes> RangeSync<T> {
|
||||
);
|
||||
}
|
||||
self.chains.update(network);
|
||||
self.chains.update_sync_state();
|
||||
self.chains.update_sync_state(network);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,7 +292,7 @@ impl<T: BeaconChainTypes> RangeSync<T> {
|
||||
// head chain.
|
||||
self.chains.set_head_sync();
|
||||
// Update the global variables
|
||||
self.chains.update_sync_state();
|
||||
self.chains.update_sync_state(network);
|
||||
|
||||
// if there are no more finalized chains, re-status all known peers awaiting a head
|
||||
// sync
|
||||
@@ -329,7 +329,7 @@ impl<T: BeaconChainTypes> RangeSync<T> {
|
||||
// update the state of the collection
|
||||
self.chains.update(network);
|
||||
// update the global state and log any change
|
||||
self.chains.update_sync_state();
|
||||
self.chains.update_sync_state(network);
|
||||
}
|
||||
Some((_, ProcessingResult::KeepChain)) => {}
|
||||
None => {
|
||||
@@ -358,7 +358,7 @@ impl<T: BeaconChainTypes> RangeSync<T> {
|
||||
// update the state of the collection
|
||||
self.chains.update(network);
|
||||
// update the global state and inform the user
|
||||
self.chains.update_sync_state();
|
||||
self.chains.update_sync_state(network);
|
||||
}
|
||||
|
||||
/// When a peer gets removed, both the head and finalized chains need to be searched to check which pool the peer is in. The chain may also have a batch or batches awaiting
|
||||
|
||||
Reference in New Issue
Block a user