Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | while (nHeight < nHeightEnd && !ShutdownRequested()) { | ||||
CBlock *pblock = &pblocktemplate->block; | CBlock *pblock = &pblocktemplate->block; | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
IncrementExtraNonce(config, pblock, chainActive.Tip(), nExtraNonce); | IncrementExtraNonce(config, pblock, chainActive.Tip(), nExtraNonce); | ||||
} | } | ||||
while (nMaxTries > 0 && pblock->nNonce < nInnerLoopCount && | while (nMaxTries > 0 && pblock->nNonce < nInnerLoopCount && | ||||
!CheckProofOfWork(pblock->GetHash(), pblock->nBits, config)) { | !CheckProofOfWork(pblock->GetHash(), pblock->nBits, | ||||
config.GetChainParams().GetConsensus())) { | |||||
++pblock->nNonce; | ++pblock->nNonce; | ||||
--nMaxTries; | --nMaxTries; | ||||
} | } | ||||
if (nMaxTries == 0) { | if (nMaxTries == 0) { | ||||
break; | break; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 438 Lines • ▼ Show 20 Lines | if (pindexPrev != chainActive.Tip() || | ||||
pindexPrev = pindexPrevNew; | pindexPrev = pindexPrevNew; | ||||
} | } | ||||
assert(pindexPrev); | assert(pindexPrev); | ||||
// pointer for convenience | // pointer for convenience | ||||
CBlock *pblock = &pblocktemplate->block; | CBlock *pblock = &pblocktemplate->block; | ||||
// Update nTime | // Update nTime | ||||
UpdateTime(pblock, config, pindexPrev); | UpdateTime(pblock, config.GetChainParams().GetConsensus(), pindexPrev); | ||||
pblock->nNonce = 0; | pblock->nNonce = 0; | ||||
UniValue aCaps(UniValue::VARR); | UniValue aCaps(UniValue::VARR); | ||||
aCaps.push_back("proposal"); | aCaps.push_back("proposal"); | ||||
UniValue transactions(UniValue::VARR); | UniValue transactions(UniValue::VARR); | ||||
int index_in_template = 0; | int index_in_template = 0; | ||||
for (const auto &it : pblock->vtx) { | for (const auto &it : pblock->vtx) { | ||||
▲ Show 20 Lines • Show All 182 Lines • Show Last 20 Lines |