mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-19 03:04:27 -05:00
refactor: refactor get_idle_peer_for to use Iterator::find (#21321)
This commit is contained in:
@@ -188,13 +188,7 @@ impl<N: NetworkPrimitives> TransactionFetcher<N> {
|
||||
let TxFetchMetadata { fallback_peers, .. } =
|
||||
self.hashes_fetch_inflight_and_pending_fetch.peek(&hash)?;
|
||||
|
||||
for peer_id in fallback_peers.iter() {
|
||||
if self.is_idle(peer_id) {
|
||||
return Some(peer_id)
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
fallback_peers.iter().find(|peer_id| self.is_idle(peer_id))
|
||||
}
|
||||
|
||||
/// Returns any idle peer for any hash pending fetch. If one is found, the corresponding
|
||||
|
||||
Reference in New Issue
Block a user