Add mostly-static checks on consistency of Equihash parameters, MAX_HEADERS_RESULTS, and MAX_PROTOCOL_MESSAGE_LENGTH.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
@@ -94,6 +94,10 @@ static const unsigned int DATABASE_FLUSH_INTERVAL = 24 * 60 * 60;
|
||||
/** Maximum length of reject messages. */
|
||||
static const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111;
|
||||
|
||||
#define equihash_parameters_acceptable(N, K) \
|
||||
((CBlockHeader::HEADER_SIZE + equihash_solution_size(N, K))*MAX_HEADERS_RESULTS < \
|
||||
MAX_PROTOCOL_MESSAGE_LENGTH-1000)
|
||||
|
||||
struct BlockHasher
|
||||
{
|
||||
size_t operator()(const uint256& hash) const { return hash.GetCheapHash(); }
|
||||
|
||||
Reference in New Issue
Block a user