Skip to content

Commit

Permalink
staking fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bitgdev committed Aug 14, 2018
1 parent 9f2077e commit 6f1e309
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,12 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet,
pblock->nNonce = 0;
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);

// CValidationState state;
// if (!TestBlockValidity(state, *pblock, pindexPrev, false, false)) {
// LogPrintf("CreateNewBlock() : TestBlockValidity failed\n");
// mempool.clear();
// return NULL;
// }
CValidationState state;
if (!TestBlockValidity(state, *pblock, pindexPrev, false, false)) {
LogPrintf("CreateNewBlock() : TestBlockValidity failed\n");
mempool.clear();
return NULL;
}
}

return pblocktemplate.release();
Expand Down Expand Up @@ -486,18 +486,12 @@ void BitcoinMiner(CWallet* pwallet, bool fProofOfStake)
continue;
}

while (vNodes.empty() || pwallet->IsLocked() || !fMintableCoins || (pwallet->GetBalance() > 0 && nReserveBalance >= pwallet->GetBalance())) {
if (vNodes.empty() || pwallet->IsLocked() || !fMintableCoins ||
(pwallet->GetBalance() > 0 && nReserveBalance >= pwallet->GetBalance()) ||
!masternodeSync.IsSynced()) {
nLastCoinStakeSearchInterval = 0;
// Do a separate 1 minute check here to ensure fMintableCoins is updated
if (!fMintableCoins) {
if (GetTime() - nMintableLastCheck > 1 * 60) { // 1 minute check time
nMintableLastCheck = GetTime();
fMintableCoins = pwallet->MintableCoins();
}
}
MilliSleep(5000);
if (!fGenerateBitcoins && !fProofOfStake)
continue;
continue;
}

if (mapHashedBlocks.count(chainActive.Tip()->nHeight)) { //search our map of hashed blocks, see if bestblock has been hashed yet
Expand Down

0 comments on commit 6f1e309

Please sign in to comment.