From 87dfca56a363557f89aec8f8cd667d267c6d1af4 Mon Sep 17 00:00:00 2001 From: "crypro.zoidberg" Date: Sat, 9 Mar 2019 02:12:10 +0100 Subject: [PATCH] extended limitations on NOTIFY_REQUEST_GET_OBJECTS --- src/currency_core/currency_config.h | 4 ++-- src/currency_protocol/currency_protocol_handler.inl | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/currency_core/currency_config.h b/src/currency_core/currency_config.h index 3f6684aa..71608c76 100644 --- a/src/currency_core/currency_config.h +++ b/src/currency_core/currency_config.h @@ -1,5 +1,4 @@ // Copyright (c) 2014-2018 Zano Project -// Copyright (c) 2014-2018 Zano Project // Copyright (c) 2014-2018 The Louisdor Project // Copyright (c) 2012-2013 The Cryptonote developers // Distributed under the MIT/X11 software license, see the accompanying @@ -98,7 +97,8 @@ #define BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT 2000 //by default, blocks ids count in synchronizing #define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT 200 //by default, blocks count in blocks downloading #define BLOCKS_SYNCHRONIZING_DEFAULT_SIZE 2000000 //by default keep synchronizing packets not bigger then 2MB -#define CURRENCY_PROTOCOL_MAX_BLOCKS_REQUEST_COUNT 500 +#define CURRENCY_PROTOCOL_MAX_BLOCKS_REQUEST_COUNT 500 +#define CURRENCY_PROTOCOL_MAX_TXS_REQUEST_COUNT 500 #define CURRENCY_ALT_BLOCK_LIVETIME_COUNT (CURRENCY_BLOCKS_PER_DAY*7)//one week diff --git a/src/currency_protocol/currency_protocol_handler.inl b/src/currency_protocol/currency_protocol_handler.inl index 617fb862..0485525f 100644 --- a/src/currency_protocol/currency_protocol_handler.inl +++ b/src/currency_protocol/currency_protocol_handler.inl @@ -361,7 +361,8 @@ namespace currency LOG_PRINT_L2("[HANDLE]NOTIFY_REQUEST_GET_OBJECTS: arg.blocks.size() = " << arg.blocks.size() << ", arg.txs.size()="<< arg.txs.size()); LOG_PRINT_L3("[HANDLE]NOTIFY_REQUEST_GET_OBJECTS: " << ENDL << currency::print_kv_structure(arg)); - if (arg.blocks.size() > CURRENCY_PROTOCOL_MAX_BLOCKS_REQUEST_COUNT) + if (arg.blocks.size() > CURRENCY_PROTOCOL_MAX_BLOCKS_REQUEST_COUNT || + arg.txs.size() > CURRENCY_PROTOCOL_MAX_TXS_REQUEST_COUNT) { LOG_ERROR_CCONTEXT("Requested objects count is to big (" << arg.blocks.size() <<")expected not more then " << CURRENCY_PROTOCOL_MAX_BLOCKS_REQUEST_COUNT); m_p2p->drop_connection(context);