2) keep 40% of the best performing peers on any individual metric:
This means an eclipse attacker most outperform the best individual performer with all of its rankings.
3) from the remaining peers, evicted peers are selected via a weighted choose function accounting for time-connected and prefix_bucket:
Here weights are not influenced by latency (as to not starve low-latency peers), This will also cause the node to prefer selection of newer peers, and peers from localized clusters (via prefix bucket), for eviction.
On the side, it also logs last tx transfer and last block transfer for each peer, as well as does a small overhaul on the PrefixBucket struct, (mostly inlining and refactoring).
This adds eviction logic and a policy to rusty-kaspa.
The idea is borrowed from btc and straight forward:
1) rank peers, by
last_ping_duration
,time_connected
,last_tx_transfer
(duration),last_block_transfer
(duration),prefix_bucket
(dispersal).2) keep 40% of the best performing peers on any individual metric:
3) from the remaining peers, evicted peers are selected via a weighted choose function accounting for
time-connected
andprefix_bucket
:On the side, it also logs last tx transfer and last block transfer for each peer, as well as does a small overhaul on the PrefixBucket struct, (mostly inlining and refactoring).