mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Sync cleanups (#8230)
N/A 1. In the batch retry logic, we were failing to set the batch state to `AwaitingDownload` before attempting a retry. This PR sets it to `AwaitingDownload` before the retry and sets it back to `Downloading` if the retry suceeded in sending out a request 2. Remove all peer scoring logic from retrying and rely on just de priorotizing the failed peer. I finally concede the point to @dapplion 😄 3. Changes `block_components_by_range_request` to accept `block_peers` and `column_peers`. This is to ensure that we use the full synced peerset for requesting columns in order to avoid splitting the column peers among multiple head chains. During forward sync, we want the block peers to be the peers from the syncing chain and column peers to be all synced peers from the peerdb. Also, fixes a typo and calls `attempt_send_awaiting_download_batches` from more places Co-Authored-By: Pawan Dhananjay <pawandhananjay@gmail.com>
This commit is contained in:
@@ -247,23 +247,16 @@ impl<E: EthSpec> PeerDB<E> {
|
||||
.map(|(peer_id, _)| peer_id)
|
||||
}
|
||||
|
||||
/// Returns all the synced peers from the list of allowed peers that claim to have the block
|
||||
/// Returns all the synced peers from the peer db that claim to have the block
|
||||
/// components for the given epoch based on `status.earliest_available_slot`.
|
||||
///
|
||||
/// If `earliest_available_slot` info is not available, then return peer anyway assuming it has the
|
||||
/// required data.
|
||||
///
|
||||
/// If `allowed_peers` is `Some`, then filters for the epoch only for those peers.
|
||||
pub fn synced_peers_for_epoch<'a>(
|
||||
&'a self,
|
||||
epoch: Epoch,
|
||||
allowed_peers: Option<&'a HashSet<PeerId>>,
|
||||
) -> impl Iterator<Item = &'a PeerId> {
|
||||
pub fn synced_peers_for_epoch(&self, epoch: Epoch) -> impl Iterator<Item = &PeerId> {
|
||||
self.peers
|
||||
.iter()
|
||||
.filter(move |(peer_id, info)| {
|
||||
allowed_peers.is_none_or(|allowed| allowed.contains(peer_id))
|
||||
&& info.is_connected()
|
||||
.filter(move |(_, info)| {
|
||||
info.is_connected()
|
||||
&& match info.sync_status() {
|
||||
SyncStatus::Synced { info } => {
|
||||
info.has_slot(epoch.end_slot(E::slots_per_epoch()))
|
||||
|
||||
Reference in New Issue
Block a user