From 551a8d957c4c44afbd0d608fcdf7c6a4352babce Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Wed, 9 Feb 2022 09:38:52 -0500 Subject: Utilize anti-DoS headers download strategy Avoid permanently storing headers from a peer, unless the headers are part of a chain with sufficiently high work. This prevents memory attacks using low-work headers. Designed and co-authored with Pieter Wuille. --- src/validation.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/validation.h') diff --git a/src/validation.h b/src/validation.h index b1b6689c46..64217e6a11 100644 --- a/src/validation.h +++ b/src/validation.h @@ -340,6 +340,12 @@ bool TestBlockValidity(BlockValidationState& state, bool fCheckPOW = true, bool fCheckMerkleRoot = true) EXCLUSIVE_LOCKS_REQUIRED(cs_main); +/** Check with the proof of work on each blockheader matches the value in nBits */ +bool HasValidProofOfWork(const std::vector& headers, const Consensus::Params& consensusParams); + +/** Return the sum of the work on a given set of headers */ +arith_uint256 CalculateHeadersWork(const std::vector& headers); + /** RAII wrapper for VerifyDB: Verify consistency of the block and coin databases */ class CVerifyDB { public: -- cgit v1.2.3