skip dpow check on everything but ProcessNewBlock.
This commit is contained in:
12
src/main.cpp
12
src/main.cpp
@@ -4231,7 +4231,7 @@ static void PruneBlockIndexCandidates() {
|
||||
* Try to make some progress towards making pindexMostWork the active block.
|
||||
* pblock is either NULL or a pointer to a CBlock corresponding to pindexMostWork.
|
||||
*/
|
||||
static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMostWork, CBlock *pblock) {
|
||||
static bool ActivateBestChainStep(bool fSkipdpow, CValidationState &state, CBlockIndex *pindexMostWork, CBlock *pblock) {
|
||||
AssertLockHeld(cs_main);
|
||||
bool fInvalidFound = false;
|
||||
const CBlockIndex *pindexOldTip = chainActive.Tip();
|
||||
@@ -4241,7 +4241,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
|
||||
// stay on the same chain tip!
|
||||
int32_t notarizedht,prevMoMheight; uint256 notarizedhash,txid;
|
||||
notarizedht = komodo_notarized_height(&prevMoMheight,¬arizedhash,&txid);
|
||||
if ( pindexFork != 0 && pindexFork->GetHeight() < notarizedht )
|
||||
if ( !fSkipdpow && pindexFork != 0 && pindexFork->GetHeight() < notarizedht )
|
||||
{
|
||||
fprintf(stderr,"pindexFork->GetHeight().%d is < notarizedht %d, so ignore it\n",(int32_t)pindexFork->GetHeight(),notarizedht);
|
||||
return state.DoS(100, error("ActivateBestChainStep(): pindexFork->GetHeight().%d is < notarizedht %d, so ignore it",(int32_t)pindexFork->GetHeight(),notarizedht),
|
||||
@@ -4366,7 +4366,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
|
||||
* or an activated best chain. pblock is either NULL or a pointer to a block
|
||||
* that is already loaded (to avoid loading it again from disk).
|
||||
*/
|
||||
bool ActivateBestChain(CValidationState &state, CBlock *pblock) {
|
||||
bool ActivateBestChain(bool fSkipdpow, CValidationState &state, CBlock *pblock) {
|
||||
CBlockIndex *pindexNewTip = NULL;
|
||||
CBlockIndex *pindexMostWork = NULL;
|
||||
const CChainParams& chainParams = Params();
|
||||
@@ -4382,7 +4382,7 @@ bool ActivateBestChain(CValidationState &state, CBlock *pblock) {
|
||||
if (pindexMostWork == NULL || pindexMostWork == chainActive.Tip())
|
||||
return true;
|
||||
|
||||
if (!ActivateBestChainStep(state, pindexMostWork, pblock && pblock->GetHash() == pindexMostWork->GetBlockHash() ? pblock : NULL))
|
||||
if (!ActivateBestChainStep(fSkipdpow, state, pindexMostWork, pblock && pblock->GetHash() == pindexMostWork->GetBlockHash() ? pblock : NULL))
|
||||
return false;
|
||||
pindexNewTip = chainActive.Tip();
|
||||
fInitialDownload = IsInitialBlockDownload();
|
||||
@@ -5542,7 +5542,7 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo
|
||||
//else fprintf(stderr,"added block %s %p\n",pindex->GetBlockHash().ToString().c_str(),pindex->pprev);
|
||||
}
|
||||
|
||||
if (futureblock == 0 && !ActivateBestChain(state, pblock))
|
||||
if (futureblock == 0 && !ActivateBestChain(false, state, pblock))
|
||||
return error("%s: ActivateBestChain failed", __func__);
|
||||
//fprintf(stderr,"finished ProcessBlock %d\n",(int32_t)chainActive.LastTip()->GetHeight());
|
||||
|
||||
@@ -6319,7 +6319,7 @@ bool InitBlockIndex() {
|
||||
return error("LoadBlockIndex(): couldnt add to block index");
|
||||
if (!ReceivedBlockTransactions(block, state, pindex, blockPos))
|
||||
return error("LoadBlockIndex(): genesis block not accepted");
|
||||
if (!ActivateBestChain(state, &block))
|
||||
if (!ActivateBestChain(true, state, &block))
|
||||
return error("LoadBlockIndex(): genesis block cannot be activated");
|
||||
// Force a chainstate write so that when we VerifyDB in a moment, it doesn't check stale data
|
||||
return FlushStateToDisk(state, FLUSH_STATE_ALWAYS);
|
||||
|
||||
Reference in New Issue
Block a user