aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-08-15 20:54:38 +0200
committerRiccardo Spagni <ric@spagni.net>2017-08-15 20:54:38 +0200
commit4bfb58328d3bddb82074a1ef171a59a428e0c85d (patch)
tree6971e13a5ffd1ae48b6c6ea9844eda61ae5ca450
parentMerge pull request #2281 (diff)
parentp2p: fix random peer index being too large (diff)
downloadmonero-4bfb58328d3bddb82074a1ef171a59a428e0c85d.tar.xz
Merge pull request #2282
7fdc178a p2p: fix random peer index being too large (moneromooo-monero)
-rw-r--r--src/p2p/net_node.inl2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index 608edf9ae..e179fc14f 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -1126,6 +1126,8 @@ namespace nodetool
size_t random_index;
if (use_white_list) {
+ local_peers_count = m_peerlist.get_white_peers_count();
+ max_random_index = std::min<uint64_t>(local_peers_count -1, 20);
random_index = get_random_index_with_fixed_probability(max_random_index);
} else {
random_index = crypto::rand<size_t>() % m_peerlist.get_gray_peers_count();