diff options
| author | Daniel Kraft <[email protected]> | 2014-11-20 08:28:19 +0100 |
|---|---|---|
| committer | Daniel Kraft <[email protected]> | 2014-11-20 08:28:19 +0100 |
| commit | 57425a24255c5af439241d59ad5a878b7a3771a7 (patch) | |
| tree | 494a0508ddbaa0dd47f77111716e2f4f6682d5de /src/main.cpp | |
| parent | doc: add libgmp dependency for secp256k1 (diff) | |
| download | discoin-57425a24255c5af439241d59ad5a878b7a3771a7.tar.xz discoin-57425a24255c5af439241d59ad5a878b7a3771a7.zip | |
Check block header before accepting it.
Previously, AcceptBlockHeader did not check the header (in particular
PoW). This made the client accept invalid-PoW-headers from peers in
headers-first sync.
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 2bff781bf..ac5d42d5f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2280,6 +2280,8 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo { // These are checks that are independent of context. + // Check that the header is valid (particularly PoW). This is mostly + // redundant with the call in AcceptBlockHeader. if (!CheckBlockHeader(block, state, fCheckPOW)) return false; @@ -2351,6 +2353,9 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc return true; } + if (!CheckBlockHeader(block, state)) + return false; + // Get prev block index CBlockIndex* pindexPrev = NULL; int nHeight = 0; |