mirror of
https://github.com/monero-project/monero.git
synced 2025-11-28 06:50:34 -05:00
Merge pull request #7055
ff7fdf6protocol: drop peers that don't reply to queries (moneromooo-monero)89e984dkeep only the last seen node on a given host in the white list (moneromooo-monero)c74d8ffprotocol: drop peers that decrease claimed height (moneromooo-monero)61f5001protocol: add scoring system to drop peers that don't behave (moneromooo-monero)
This commit is contained in:
commit
3d2a50a5c0
6 changed files with 144 additions and 16 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ namespace nodetool
|
|||
bool get_white_peer_by_index(peerlist_entry& p, size_t i);
|
||||
bool get_gray_peer_by_index(peerlist_entry& p, size_t i);
|
||||
template<typename F> bool foreach(bool white, const F &f);
|
||||
void evict_host_from_white_peerlist(const peerlist_entry& pr);
|
||||
bool append_with_peer_white(const peerlist_entry& pr);
|
||||
bool append_with_peer_gray(const peerlist_entry& pr);
|
||||
bool append_with_peer_anchor(const anchor_peerlist_entry& ple);
|
||||
|
|
@ -345,6 +346,7 @@ namespace nodetool
|
|||
if(by_addr_it_wt == m_peers_white.get<by_addr>().end())
|
||||
{
|
||||
//put new record into white list
|
||||
evict_host_from_white_peerlist(ple);
|
||||
m_peers_white.insert(ple);
|
||||
trim_white_peerlist();
|
||||
}else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue