aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/miner.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/miner.cpp b/src/miner.cpp
index b5bfa9c7be..d7ecd5e40e 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -326,8 +326,17 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
indexDummy.nHeight = pindexPrev->nHeight + 1;
CCoinsViewCache viewNew(pcoinsTip);
CValidationState state;
+ // NOTE: CheckBlockHeader is called by CheckBlock
+ if (!ContextualCheckBlockHeader(*pblock, state, pindexPrev))
+ throw std::runtime_error("CreateNewBlock() : ContextualCheckBlockHeader failed");
+ if (!CheckBlock(*pblock, state, false, false))
+ throw std::runtime_error("CreateNewBlock() : CheckBlock failed");
+ if (!ContextualCheckBlock(*pblock, state, pindexPrev))
+ throw std::runtime_error("CreateNewBlock() : ContextualCheckBlock failed");
if (!ConnectBlock(*pblock, state, &indexDummy, viewNew, true))
throw std::runtime_error("CreateNewBlock() : ConnectBlock failed");
+ if (!state.IsValid())
+ throw std::runtime_error("CreateNewBlock() : State is not valid");
}
return pblocktemplate.release();