diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2022-02-09 09:38:52 -0500 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2022-08-29 08:10:35 -0400 |
commit | 551a8d957c4c44afbd0d608fcdf7c6a4352babce (patch) | |
tree | 774014202e3ad8560a3be4d59f94b8443e672a67 /src/validation.h | |
parent | ed470940cddbeb40425960d51cefeec4948febe4 (diff) | |
download | bitcoin-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.h | 6 |
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: |