ProcessSpecialTxsInBlock should respect fJustCheck (#2653)
* ProcessSpecialTxsInBlock should respect fJustCheck Also invoke it after subsidy/payee checks * Drop fJustCheck from CQuorumBlockProcessor
This commit is contained in:
parent
805aeaa16c
commit
559bdfc6ef
@ -444,7 +444,7 @@ CDeterministicMNManager::CDeterministicMNManager(CEvoDB& _evoDb) :
|
||||
{
|
||||
}
|
||||
|
||||
bool CDeterministicMNManager::ProcessBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& _state)
|
||||
bool CDeterministicMNManager::ProcessBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& _state, bool fJustCheck)
|
||||
{
|
||||
CDeterministicMNList oldList, newList;
|
||||
CDeterministicMNListDiff diff;
|
||||
@ -458,6 +458,10 @@ bool CDeterministicMNManager::ProcessBlock(const CBlock& block, const CBlockInde
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fJustCheck) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (newList.GetHeight() == -1) {
|
||||
newList.SetHeight(nHeight);
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ private:
|
||||
public:
|
||||
CDeterministicMNManager(CEvoDB& _evoDb);
|
||||
|
||||
bool ProcessBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state);
|
||||
bool ProcessBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state, bool fJustCheck);
|
||||
bool UndoBlock(const CBlock& block, const CBlockIndex* pindex);
|
||||
|
||||
void UpdatedBlockTip(const CBlockIndex* pindex);
|
||||
|
@ -86,7 +86,7 @@ bool UndoSpecialTx(const CTransaction& tx, const CBlockIndex* pindex)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ProcessSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state)
|
||||
bool ProcessSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state, bool fJustCheck)
|
||||
{
|
||||
for (int i = 0; i < (int)block.vtx.size(); i++) {
|
||||
const CTransaction& tx = *block.vtx[i];
|
||||
@ -102,7 +102,7 @@ bool ProcessSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, CV
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!deterministicMNManager->ProcessBlock(block, pindex, state)) {
|
||||
if (!deterministicMNManager->ProcessBlock(block, pindex, state, fJustCheck)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ class CBlockIndex;
|
||||
class CValidationState;
|
||||
|
||||
bool CheckSpecialTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CValidationState& state);
|
||||
bool ProcessSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state);
|
||||
bool ProcessSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state, bool fJustCheck);
|
||||
bool UndoSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex);
|
||||
|
||||
template <typename T>
|
||||
|
@ -2184,10 +2184,6 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd
|
||||
int64_t nTime4 = GetTimeMicros(); nTimeVerify += nTime4 - nTime2;
|
||||
LogPrint("bench", " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs]\n", nInputs - 1, 0.001 * (nTime4 - nTime2), nInputs <= 1 ? 0 : 0.001 * (nTime4 - nTime2) / (nInputs-1), nTimeVerify * 0.000001);
|
||||
|
||||
if (!ProcessSpecialTxsInBlock(block, pindex, state)) {
|
||||
return error("ConnectBlock(): ProcessSpecialTxsInBlock for block %s failed with %s",
|
||||
pindex->GetBlockHash().ToString(), FormatStateMessage(state));
|
||||
}
|
||||
|
||||
// DASH : MODIFIED TO CHECK MASTERNODE PAYMENTS AND SUPERBLOCKS
|
||||
|
||||
@ -2208,6 +2204,12 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd
|
||||
return state.DoS(0, error("ConnectBlock(DASH): couldn't find masternode or superblock payments"),
|
||||
REJECT_INVALID, "bad-cb-payee");
|
||||
}
|
||||
|
||||
if (!ProcessSpecialTxsInBlock(block, pindex, state, fJustCheck)) {
|
||||
return error("ConnectBlock(DASH): ProcessSpecialTxsInBlock for block %s failed with %s",
|
||||
pindex->GetBlockHash().ToString(), FormatStateMessage(state));
|
||||
}
|
||||
|
||||
int64_t nTime5 = GetTimeMicros(); nTimeVerify += nTime5 - nTime4;
|
||||
LogPrint("bench", " - Payee and special txes: %.2fms [%.2fs]\n", 0.001 * (nTime4 - nTime2), nTimeVerify * 0.000001);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user