diff options
author | moneromooo <moneromoo@nowhere.nowhere.nowhere> | 2020-12-02 19:36:08 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2020-12-04 01:55:22 +0000 |
commit | 89e984d93bac087e3a84013fc006690177cdad5f (patch) | |
tree | b686316454ebde3311e712478d8f63f7f94ddd55 /src/p2p/net_peerlist.cpp | |
parent | protocol: drop peers that decrease claimed height (diff) | |
download | monero-89e984d93bac087e3a84013fc006690177cdad5f.tar.xz |
keep only the last seen node on a given host in the white list
Diffstat (limited to 'src/p2p/net_peerlist.cpp')
-rw-r--r-- | src/p2p/net_peerlist.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/p2p/net_peerlist.cpp b/src/p2p/net_peerlist.cpp index ce5c67fe5..42ab9727d 100644 --- a/src/p2p/net_peerlist.cpp +++ b/src/p2p/net_peerlist.cpp @@ -288,6 +288,19 @@ namespace nodetool copy_peers(peers.gray, m_peers_gray.get<by_addr>()); copy_peers(peers.anchor, m_peers_anchor.get<by_addr>()); } + + void peerlist_manager::evict_host_from_white_peerlist(const peerlist_entry& pr) + { + peers_indexed::index<by_time>::type& sorted_index=m_peers_white.get<by_time>(); + auto i = sorted_index.begin(); + while (i != sorted_index.end()) + { + if (i->adr.is_same_host(pr.adr)) + i = sorted_index.erase(i); + else + ++i; + } + } } BOOST_CLASS_VERSION(nodetool::peerlist_types, nodetool::CURRENT_PEERLIST_STORAGE_ARCHIVE_VER); |