Replace CValidationState param in ProcessNewBlock with BlockChecked

This commit is contained in:
Matt Corallo
2016-10-27 16:30:17 -04:00
parent 7c98ce584e
commit ae22357607
5 changed files with 28 additions and 48 deletions

View File

@@ -131,8 +131,7 @@ UniValue generateBlocks(boost::shared_ptr<CReserveScript> coinbaseScript, int nG
if (pblock->nNonce == nInnerLoopCount) {
continue;
}
CValidationState state;
if (!ProcessNewBlock(state, Params(), pblock, true, NULL, NULL))
if (!ProcessNewBlock(Params(), pblock, true, NULL, NULL))
throw JSONRPCError(RPC_INTERNAL_ERROR, "ProcessNewBlock, block not accepted");
++nHeight;
blockHashes.push_back(pblock->GetHash().GetHex());
@@ -754,10 +753,9 @@ UniValue submitblock(const JSONRPCRequest& request)
}
}
CValidationState state;
submitblock_StateCatcher sc(block.GetHash());
RegisterValidationInterface(&sc);
bool fAccepted = ProcessNewBlock(state, Params(), &block, true, NULL, NULL);
bool fAccepted = ProcessNewBlock(Params(), &block, true, NULL, NULL);
UnregisterValidationInterface(&sc);
if (fBlockPresent)
{
@@ -765,13 +763,9 @@ UniValue submitblock(const JSONRPCRequest& request)
return "duplicate-inconclusive";
return "duplicate";
}
if (fAccepted)
{
if (!sc.found)
return "inconclusive";
state = sc.state;
}
return BIP22ValidationResult(state);
if (!sc.found)
return "inconclusive";
return BIP22ValidationResult(sc.state);
}
UniValue estimatefee(const JSONRPCRequest& request)