diff options
| author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-08-11 14:29:55 +0100 |
|---|---|---|
| committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-08-11 14:29:55 +0100 |
| commit | 7fdc178abb24e89435c2465f1ffcfc5dcfd20a67 (patch) | |
| tree | c61ede934d0afd28ff2237c8f30c723fe890dc33 /src | |
| parent | 181a008aa35f130e046ec906cbb1b2436a381a62 (diff) | |
| download | monzero-core-7fdc178abb24e89435c2465f1ffcfc5dcfd20a67.tar.gz monzero-core-7fdc178abb24e89435c2465f1ffcfc5dcfd20a67.tar.xz monzero-core-7fdc178abb24e89435c2465f1ffcfc5dcfd20a67.zip | |
p2p: fix random peer index being too large
Diffstat (limited to 'src')
| -rw-r--r-- | src/p2p/net_node.inl | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 58a7f3563..38233ddb9 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(); |
