mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
Merge pull request #3153
ab58b150
p2p: fix picking peers off an empty gray list (moneromooo-monero)
This commit is contained in:
commit
5a15a8322e
1 changed files with 4 additions and 1 deletions
|
@ -1062,7 +1062,10 @@ namespace nodetool
|
||||||
max_random_index = std::min<uint64_t>(local_peers_count -1, 20);
|
max_random_index = std::min<uint64_t>(local_peers_count -1, 20);
|
||||||
random_index = get_random_index_with_fixed_probability(max_random_index);
|
random_index = get_random_index_with_fixed_probability(max_random_index);
|
||||||
} else {
|
} else {
|
||||||
random_index = crypto::rand<size_t>() % m_peerlist.get_gray_peers_count();
|
local_peers_count = m_peerlist.get_gray_peers_count();
|
||||||
|
if (!local_peers_count)
|
||||||
|
return false;
|
||||||
|
random_index = crypto::rand<size_t>() % local_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!!");
|
||||||
|
|
Loading…
Reference in a new issue