mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-12-24 06:07:46 +00:00
Make gray peer selection uniform
Prevents the system from always picking the gray peers with the most recent last_seen.
This commit is contained in:
parent
f3be9991d7
commit
1a7e18bfdf
1 changed files with 8 additions and 1 deletions
|
@ -1023,7 +1023,14 @@ namespace nodetool
|
||||||
while(rand_count < (max_random_index+1)*3 && try_count < 10 && !m_net_server.is_stop_signal_sent())
|
while(rand_count < (max_random_index+1)*3 && try_count < 10 && !m_net_server.is_stop_signal_sent())
|
||||||
{
|
{
|
||||||
++rand_count;
|
++rand_count;
|
||||||
size_t random_index = get_random_index_with_fixed_probability(max_random_index);
|
size_t random_index;
|
||||||
|
|
||||||
|
if (use_white_list) {
|
||||||
|
random_index = get_random_index_with_fixed_probability(max_random_index);
|
||||||
|
} else {
|
||||||
|
random_index = crypto::rand<size_t>() % m_peerlist.get_gray_peers_count();
|
||||||
|
}
|
||||||
|
|
||||||
CHECK_AND_ASSERT_MES(random_index < local_peers_count, false, "random_starter_index < peers_local.size() failed!!");
|
CHECK_AND_ASSERT_MES(random_index < local_peers_count, false, "random_starter_index < peers_local.size() failed!!");
|
||||||
|
|
||||||
if(tried_peers.count(random_index))
|
if(tried_peers.count(random_index))
|
||||||
|
|
Loading…
Reference in a new issue