aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-10-14 18:07:54 -0500
committerluigi1111 <luigi1111w@gmail.com>2019-10-14 18:07:54 -0500
commitdc48cdc998fde44dc744711e6e5920be73f74a36 (patch)
tree3b8f6085b93e060ad2d75cbc8b8deedff581910e /src/rpc
parentMerge pull request #5834 (diff)
parentban peers sending bad pow outright (diff)
downloadmonero-dc48cdc998fde44dc744711e6e5920be73f74a36.tar.xz
Merge pull request #5933
3455efa ban peers sending bad pow outright (moneromooo-monero)
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/core_rpc_server.cpp4
-rw-r--r--src/rpc/core_rpc_server.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index fef86fd34..6f5f912cd 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)
{
diff --git a/src/rpc/core_rpc_server.h b/src/rpc/core_rpc_server.h
index 379f6ed28..fe03012b7 100644
--- a/src/rpc/core_rpc_server.h
+++ b/src/rpc/core_rpc_server.h
@@ -241,7 +241,7 @@ namespace cryptonote
private:
bool check_core_busy();
bool check_core_ready();
- bool add_host_fail(const connection_context *ctx);
+ bool add_host_fail(const connection_context *ctx, unsigned int score = 1);
//utils
uint64_t get_block_reward(const block& blk);