Skip to content

Commit cef0979

Browse files
authored
Revert "PeerPool refactoring and custom filtering (#7023)" (#7038)
This reverts commit ad52ba3.
1 parent 95f590c commit cef0979

File tree

4 files changed

+482
-997
lines changed

4 files changed

+482
-997
lines changed

AllTests-mainnet.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,6 @@ AllTests-mainnet
792792
+ Access peers by key test OK
793793
+ Acquire from empty pool OK
794794
+ Acquire/Sorting and consistency test OK
795-
+ Custom filters test OK
796795
+ Delete peer on release text OK
797796
+ Iterators test OK
798797
+ Peer lifetime test OK

beacon_chain/networking/eth2_network.nim

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,12 +480,15 @@ func netKbps*(peer: Peer): float {.inline.} =
480480
## Returns current network throughput average value in Kbps for peer ``peer``.
481481
round(((peer.netThroughput.average / 1024) * 10_000) / 10_000)
482482
483-
# /!\ Must be exported to be seen by `peerpool`.
484-
func cmp*(a, b: Peer): int =
485-
if a.score == b.score:
486-
cmp(a.netThroughput.average, b.netThroughput.average)
483+
# /!\ Must be exported to be seen by `peerCmp`
484+
func `<`*(a, b: Peer): bool =
485+
## Comparison function indicating `true` if peer `a` ranks worse than peer `b`
486+
if a.score != b.score:
487+
a.score < b.score
488+
elif a.netThroughput.average != b.netThroughput.average:
489+
a.netThroughput.average < b.netThroughput.average
487490
else:
488-
cmp(a.score, b.score)
491+
system.`<`(a, b)
489492
490493
const
491494
maxRequestQuota = 1000000

0 commit comments

Comments
 (0)