diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-09-24 13:08:25 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-09-25 16:00:43 +0000 |
commit | 3455efafa812d646f2eea42db14b761f34975147 (patch) | |
tree | dffe8ec81dc709f86bbb004017aca3dfa77efa30 /src/rpc/core_rpc_server.cpp | |
parent | Merge pull request #5928 (diff) | |
download | monero-3455efafa812d646f2eea42db14b761f34975147.tar.xz |
ban peers sending bad pow outright
PoW is expensive to verify, so be strict
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 3f53d59cf..ac8e0784f 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -217,13 +217,13 @@ namespace cryptonote return true; } //------------------------------------------------------------------------------------------------------------------------------ - bool core_rpc_server::add_host_fail(const connection_context *ctx) + bool core_rpc_server::add_host_fail(const connection_context *ctx, unsigned int score) { if(!ctx || !ctx->m_remote_address.is_blockable()) return false; CRITICAL_REGION_LOCAL(m_host_fails_score_lock); - uint64_t fails = ++m_host_fails_score[ctx->m_remote_address.host_str()]; + uint64_t fails = m_host_fails_score[ctx->m_remote_address.host_str()] += score; MDEBUG("Host " << ctx->m_remote_address.host_str() << " fail score=" << fails); if(fails > RPC_IP_FAILS_BEFORE_BLOCK) { |