Skip to content

Commit

Permalink
[Core] Restore CheckBlock checks before previous block check
Browse files Browse the repository at this point in the history
in ProcessNewBlock (as it was before nStakeModifierV2) to avoid possible
syncing issues.
  • Loading branch information
random-zebra committed Nov 20, 2019
1 parent 3bb0c0a commit 79bdc83
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5169,6 +5169,15 @@ void CBlockIndex::BuildSkip()

bool ProcessNewBlock(CValidationState& state, CNode* pfrom, CBlock* pblock, CDiskBlockPos* dbp)
{
// Preliminary checks
int64_t nStartTime = GetTimeMillis();

// check block
bool checked = CheckBlock(*pblock, state);

if (!CheckBlockSignature(*pblock))
return error("%s : bad proof-of-stake block signature", __func__);

if (pblock->GetHash() != Params().HashGenesisBlock() && pfrom != NULL) {
//if we get this far, check if the prev block is our prev block, if not then request sync and return false
BlockMap::iterator mi = mapBlockIndex.find(pblock->hashPrevBlock);
Expand All @@ -5178,15 +5187,6 @@ bool ProcessNewBlock(CValidationState& state, CNode* pfrom, CBlock* pblock, CDis
}
}

// Preliminary checks
int64_t nStartTime = GetTimeMillis();

// check block
bool checked = CheckBlock(*pblock, state);

if (!CheckBlockSignature(*pblock))
return error("ProcessNewBlock() : bad proof-of-stake block signature");

{
LOCK(cs_main);

Expand Down

0 comments on commit 79bdc83

Please sign in to comment.