cryptonote_protocol: expand basic DoS protection
Count transactions as well
This commit is contained in:
parent
8f66b7053a
commit
1cc61018e5
|
@ -52,7 +52,7 @@ PUSH_WARNINGS
|
||||||
DISABLE_VS_WARNINGS(4355)
|
DISABLE_VS_WARNINGS(4355)
|
||||||
|
|
||||||
#define LOCALHOST_INT 2130706433
|
#define LOCALHOST_INT 2130706433
|
||||||
#define CURRENCY_PROTOCOL_MAX_BLOCKS_REQUEST_COUNT 500
|
#define CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT 500
|
||||||
|
|
||||||
namespace cryptonote
|
namespace cryptonote
|
||||||
{
|
{
|
||||||
|
|
|
@ -915,12 +915,12 @@ namespace cryptonote
|
||||||
{
|
{
|
||||||
MLOG_P2P_MESSAGE("Received NOTIFY_REQUEST_GET_OBJECTS (" << arg.blocks.size() << " blocks, " << arg.txs.size() << " txes)");
|
MLOG_P2P_MESSAGE("Received NOTIFY_REQUEST_GET_OBJECTS (" << arg.blocks.size() << " blocks, " << arg.txs.size() << " txes)");
|
||||||
|
|
||||||
if (arg.blocks.size() > CURRENCY_PROTOCOL_MAX_BLOCKS_REQUEST_COUNT)
|
if (arg.blocks.size() + arg.txs.size() > CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT)
|
||||||
{
|
{
|
||||||
LOG_ERROR_CCONTEXT(
|
LOG_ERROR_CCONTEXT(
|
||||||
"Requested objects count is too big ("
|
"Requested objects count is too big ("
|
||||||
<< arg.blocks.size() << ") expected not more then "
|
<< arg.blocks.size() + arg.txs.size() << ") expected not more then "
|
||||||
<< CURRENCY_PROTOCOL_MAX_BLOCKS_REQUEST_COUNT);
|
<< CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT);
|
||||||
drop_connection(context, false, false);
|
drop_connection(context, false, false);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue