Skip to content

Commit 5c4dffd

Browse files
committed
Merge pull request #5270
57425a2 Check block header before accepting it. (Daniel Kraft)
2 parents 3ba5ebc + 57425a2 commit 5c4dffd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,6 +2280,8 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
22802280
{
22812281
// These are checks that are independent of context.
22822282

2283+
// Check that the header is valid (particularly PoW). This is mostly
2284+
// redundant with the call in AcceptBlockHeader.
22832285
if (!CheckBlockHeader(block, state, fCheckPOW))
22842286
return false;
22852287

@@ -2351,6 +2353,9 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
23512353
return true;
23522354
}
23532355

2356+
if (!CheckBlockHeader(block, state))
2357+
return false;
2358+
23542359
// Get prev block index
23552360
CBlockIndex* pindexPrev = NULL;
23562361
int nHeight = 0;

0 commit comments

Comments
 (0)