aboutsummaryrefslogtreecommitdiff
path: root/src/validation.h
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2022-02-09 09:38:52 -0500
committerSuhas Daftuar <sdaftuar@gmail.com>2022-08-29 08:10:35 -0400
commit551a8d957c4c44afbd0d608fcdf7c6a4352babce (patch)
tree774014202e3ad8560a3be4d59f94b8443e672a67 /src/validation.h
parented470940cddbeb40425960d51cefeec4948febe4 (diff)
downloadbitcoin-551a8d957c4c44afbd0d608fcdf7c6a4352babce.tar.xz
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.
Diffstat (limited to 'src/validation.h')
-rw-r--r--src/validation.h6
1 files changed, 6 insertions, 0 deletions
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<CBlockHeader>& headers, const Consensus::Params& consensusParams);
+
+/** Return the sum of the work on a given set of headers */
+arith_uint256 CalculateHeadersWork(const std::vector<CBlockHeader>& headers);
+
/** RAII wrapper for VerifyDB: Verify consistency of the block and coin databases */
class CVerifyDB {
public: