Avoid duplicate CheckBlock checks
(cherry picked from commit bitcoin/bitcoin@3b33ec85ed)
This commit is contained in:
parent
204d0c37ab
commit
542fcfe69d
|
@ -4730,6 +4730,9 @@ bool CheckBlock(const CBlock& block,
|
|||
{
|
||||
// These are checks that are independent of context.
|
||||
|
||||
if (block.fChecked)
|
||||
return true;
|
||||
|
||||
// Check that the header is valid (particularly PoW). This is mostly
|
||||
// redundant with the call in AcceptBlockHeader.
|
||||
if (!CheckBlockHeader(block, state, chainparams, fCheckPOW))
|
||||
|
@ -4788,6 +4791,9 @@ bool CheckBlock(const CBlock& block,
|
|||
return state.DoS(100, error("CheckBlock(): out-of-bounds SigOpCount"),
|
||||
REJECT_INVALID, "bad-blk-sigops", true);
|
||||
|
||||
if (fCheckPOW && fCheckMerkleRoot)
|
||||
block.fChecked = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,6 +89,9 @@ public:
|
|||
// network and disk
|
||||
std::vector<CTransaction> vtx;
|
||||
|
||||
// memory only
|
||||
mutable bool fChecked;
|
||||
|
||||
CBlock()
|
||||
{
|
||||
SetNull();
|
||||
|
@ -112,6 +115,7 @@ public:
|
|||
{
|
||||
CBlockHeader::SetNull();
|
||||
vtx.clear();
|
||||
fChecked = false;
|
||||
}
|
||||
|
||||
CBlockHeader GetBlockHeader() const
|
||||
|
|
Loading…
Reference in New Issue