mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-29 16:24:22 +00:00
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.
This commit is contained in:
parent
b5d1b10929
commit
57425a2425
@ -2280,6 +2280,8 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
|
|||||||
{
|
{
|
||||||
// These are checks that are independent of context.
|
// 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))
|
if (!CheckBlockHeader(block, state, fCheckPOW))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -2351,6 +2353,9 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!CheckBlockHeader(block, state))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get prev block index
|
// Get prev block index
|
||||||
CBlockIndex* pindexPrev = NULL;
|
CBlockIndex* pindexPrev = NULL;
|
||||||
int nHeight = 0;
|
int nHeight = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user