Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/misc.cpp
Show First 20 Lines • Show All 324 Lines • ▼ Show 20 Lines | static UniValue setmocktime(const Config &config, | ||||
// 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 | ||||
// 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 call sites of GetTime() are accessing this safely. | // ensure all call sites 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()); | int64_t mockTime = request.params[0].get_int64(); | ||||
if (mockTime < 0) { | |||||
throw JSONRPCError(RPC_INVALID_PARAMETER, | |||||
"Timestamp must be 0 or greater"); | |||||
} | |||||
SetMockTime(mockTime); | |||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
static UniValue RPCLockedMemoryInfo() { | static UniValue RPCLockedMemoryInfo() { | ||||
LockedPool::Stats stats = LockedPoolManager::Instance().stats(); | LockedPool::Stats stats = LockedPoolManager::Instance().stats(); | ||||
UniValue obj(UniValue::VOBJ); | UniValue obj(UniValue::VOBJ); | ||||
obj.pushKV("used", uint64_t(stats.used)); | obj.pushKV("used", uint64_t(stats.used)); | ||||
▲ Show 20 Lines • Show All 253 Lines • Show Last 20 Lines |