Skip to content

Commit 4540195

Browse files
committed
Request columns from global peer pool
1 parent fdce537 commit 4540195

File tree

2 files changed

+12
-10
lines changed
  • beacon_node

2 files changed

+12
-10
lines changed

beacon_node/lighthouse_network/src/peer_manager/peerdb.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ impl<E: EthSpec> PeerDB<E> {
323323
.map(|(peer_id, _)| peer_id)
324324
}
325325

326+
/// Returns an iterator of all good gossipsub peers that are supposed to be custodying
327+
/// the given subnet id.
326328
pub fn good_custody_subnet_peer_range_sync(
327329
&self,
328330
subnet: DataColumnSubnetId,

beacon_node/network/src/sync/range_sync/chain.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
957957
.network_globals()
958958
.peers
959959
.read()
960-
.synced_peers_for_epoch(batch_id, Some(&self.peers))
960+
.synced_peers_for_epoch(batch_id, None)
961961
.cloned()
962962
.collect::<HashSet<_>>();
963963

@@ -1034,7 +1034,7 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
10341034
.network_globals()
10351035
.peers
10361036
.read()
1037-
.synced_peers_for_epoch(batch_id, Some(&self.peers))
1037+
.synced_peers_for_epoch(batch_id, None)
10381038
.cloned()
10391039
.collect::<HashSet<_>>();
10401040

@@ -1129,21 +1129,21 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
11291129
) -> bool {
11301130
if network.chain.spec.is_peer_das_enabled_for_epoch(epoch) {
11311131
// Require peers on all sampling column subnets before sending batches
1132-
network
1132+
let peers_on_all_custody_subnets = network
11331133
.network_globals()
11341134
.sampling_subnets()
11351135
.iter()
11361136
.all(|subnet_id| {
1137-
let peer_db = network.network_globals().peers.read();
1138-
let peer_count = self
1137+
let peer_count = network
1138+
.network_globals()
11391139
.peers
1140-
.iter()
1141-
.filter(|peer| {
1142-
peer_db.is_good_range_sync_custody_subnet_peer(*subnet_id, peer)
1143-
})
1140+
.read()
1141+
.good_custody_subnet_peer_range_sync(*subnet_id, epoch)
11441142
.count();
1143+
11451144
peer_count > 0
1146-
})
1145+
});
1146+
peers_on_all_custody_subnets
11471147
} else {
11481148
true
11491149
}

0 commit comments

Comments
 (0)