Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | return GetNetworkHashPS( | ||||
!request.params[0].isNull() ? request.params[0].get_int() : 120, | !request.params[0].isNull() ? request.params[0].get_int() : 120, | ||||
!request.params[1].isNull() ? request.params[1].get_int() : -1); | !request.params[1].isNull() ? request.params[1].get_int() : -1); | ||||
} | } | ||||
UniValue generateBlocks(const Config &config, | UniValue generateBlocks(const Config &config, | ||||
std::shared_ptr<CReserveScript> coinbaseScript, | std::shared_ptr<CReserveScript> coinbaseScript, | ||||
int nGenerate, uint64_t nMaxTries, bool keepScript) { | int nGenerate, uint64_t nMaxTries, bool keepScript) { | ||||
static const int nInnerLoopCount = 0x100000; | static const int nInnerLoopCount = 0x100000; | ||||
int nHeightStart = 0; | |||||
int nHeightEnd = 0; | int nHeightEnd = 0; | ||||
int nHeight = 0; | int nHeight = 0; | ||||
{ | { | ||||
// Don't keep cs_main locked. | // Don't keep cs_main locked. | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
nHeightStart = chainActive.Height(); | nHeight = chainActive.Height(); | ||||
nHeight = nHeightStart; | nHeightEnd = nHeight + nGenerate; | ||||
nHeightEnd = nHeightStart + nGenerate; | |||||
} | } | ||||
unsigned int nExtraNonce = 0; | unsigned int nExtraNonce = 0; | ||||
UniValue blockHashes(UniValue::VARR); | UniValue blockHashes(UniValue::VARR); | ||||
while (nHeight < nHeightEnd && !ShutdownRequested()) { | while (nHeight < nHeightEnd && !ShutdownRequested()) { | ||||
std::unique_ptr<CBlockTemplate> pblocktemplate( | std::unique_ptr<CBlockTemplate> pblocktemplate( | ||||
BlockAssembler(config, g_mempool) | BlockAssembler(config, g_mempool) | ||||
.CreateNewBlock(coinbaseScript->reserveScript)); | .CreateNewBlock(coinbaseScript->reserveScript)); | ||||
▲ Show 20 Lines • Show All 679 Lines • Show Last 20 Lines |