Add header spam protection

This commit is contained in:
lateminer
2019-04-01 23:39:03 +03:00
parent 5d85509142
commit 248fb13834
3 changed files with 144 additions and 2 deletions

View File

@@ -3,6 +3,9 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// Header spam protection by Qtum
// Copyright (c) 2016-2019 The Qtum developers
#ifndef BITCOIN_MAIN_H
#define BITCOIN_MAIN_H
@@ -139,6 +142,13 @@ static const bool DEFAULT_TESTSAFEMODE = false;
/** Default for using fee filter */
static const bool DEFAULT_FEEFILTER = true;
/** Default for -headerspamfilter, use header spam filter */
static const bool DEFAULT_HEADER_SPAM_FILTER = true;
/** Default for -headerspamfiltermaxsize, maximum size of the list of indexes in the header spam filter */
static const unsigned int DEFAULT_HEADER_SPAM_FILTER_MAX_SIZE = 500;
/** Default for -headerspamfiltermaxavg, maximum average size of an index occurrence in the header spam filter */
static const unsigned int DEFAULT_HEADER_SPAM_FILTER_MAX_AVG = 10;
/** Maximum number of headers to announce when relaying blocks with headers message.*/
static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8;