aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol/cryptonote_protocol_handler.h
diff options
context:
space:
mode:
authormoneromooo <moneromoo@nowhere.nowhere.nowhere>2020-12-01 22:25:07 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2020-12-04 01:55:01 +0000
commit1382b17aa11b8cdb1c31c75052ef1459f1d137a2 (patch)
treeec033d8704e55f998c1becf15238f63739b101bf /src/cryptonote_protocol/cryptonote_protocol_handler.h
parentMerge pull request #7010 (diff)
downloadmonero-1382b17aa11b8cdb1c31c75052ef1459f1d137a2.tar.xz
protocol: add scoring system to drop peers that don't behave
Diffstat (limited to 'src/cryptonote_protocol/cryptonote_protocol_handler.h')
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.h b/src/cryptonote_protocol/cryptonote_protocol_handler.h
index 61aac6d81..06b7f0985 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.h
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.h
@@ -148,6 +148,7 @@ namespace cryptonote
void notify_new_stripe(cryptonote_connection_context &context, uint32_t stripe);
void skip_unneeded_hashes(cryptonote_connection_context& context, bool check_block_queue) const;
bool request_txpool_complement(cryptonote_connection_context &context);
+ void hit_score(cryptonote_connection_context &context, int32_t score);
t_core& m_core;
@@ -163,6 +164,7 @@ namespace cryptonote
epee::math_helper::once_a_time_seconds<30> m_idle_peer_kicker;
epee::math_helper::once_a_time_milliseconds<100> m_standby_checker;
epee::math_helper::once_a_time_seconds<101> m_sync_search_checker;
+ epee::math_helper::once_a_time_seconds<43> m_bad_peer_checker;
std::atomic<unsigned int> m_max_out_peers;
tools::PerformanceTimer m_sync_timer, m_add_timer;
uint64_t m_last_add_end_time;
@@ -183,6 +185,8 @@ namespace cryptonote
double get_avg_block_size();
boost::circular_buffer<size_t> m_avg_buffer = boost::circular_buffer<size_t>(10);
+ boost::mutex m_bad_peer_check_lock;
+
template<class t_parameter>
bool post_notify(typename t_parameter::request& arg, cryptonote_connection_context& context)
{