Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/misc.cpp
Show First 20 Lines • Show All 558 Lines • ▼ Show 20 Lines | static UniValue setmocktime(const Config &config, | ||||
if (!config.GetChainParams().MineBlocksOnDemand()) { | if (!config.GetChainParams().MineBlocksOnDemand()) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"setmocktime for regression testing (-regtest mode) only"); | "setmocktime for regression testing (-regtest mode) only"); | ||||
} | } | ||||
// For now, don't change mocktime if we're in the middle of validation, as | // For now, don't change mocktime if we're in the middle of validation, as | ||||
// this could have an effect on mempool time-based eviction, as well as | // this could have an effect on mempool time-based eviction, as well as | ||||
// IsCurrentForFeeEstimation() and IsInitialBlockDownload(). | // IsInitialBlockDownload(). | ||||
// TODO: figure out the right way to synchronize around mocktime, and | // TODO: figure out the right way to synchronize around mocktime, and | ||||
// ensure all callsites of GetTime() are accessing this safely. | // ensure all callsites of GetTime() are accessing this safely. | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
RPCTypeCheck(request.params, {UniValue::VNUM}); | RPCTypeCheck(request.params, {UniValue::VNUM}); | ||||
SetMockTime(request.params[0].get_int64()); | SetMockTime(request.params[0].get_int64()); | ||||
return NullUniValue; | return NullUniValue; | ||||
▲ Show 20 Lines • Show All 128 Lines • Show Last 20 Lines |