aboutsummaryrefslogtreecommitdiff
path: root/src/miner.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2014-10-20 02:10:03 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2014-11-18 19:20:10 +0000
commitdf08a626e0440457ae0d1966439fd956c27ae2fe (patch)
tree586501914259b6303dab55bd719efb1be76d5df4 /src/miner.cpp
parent4ea1be7fb84a397222754473c2bc315e3665ff18 (diff)
TestBlockValidity function for CBlock proposals (used by CreateNewBlock)
Diffstat (limited to 'src/miner.cpp')
-rw-r--r--src/miner.cpp17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/miner.cpp b/src/miner.cpp
index d7ecd5e40e..200498d109 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -321,22 +321,9 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
pblock->nNonce = 0;
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
- CBlockIndex indexDummy(*pblock);
- indexDummy.pprev = pindexPrev;
- 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");
+ if (!TestBlockValidity(state, *pblock, pindexPrev, false, false))
+ throw std::runtime_error("CreateNewBlock() : TestBlockValidity failed");
}
return pblocktemplate.release();