diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-01-26 09:57:01 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-01-26 09:57:45 +0100 |
commit | 3f9f9629cc1e4d9490dc13615114760e1889d5c6 (patch) | |
tree | 9fc9c71487eb4414e82183f82a200e8bd7bc842a /src/rpc | |
parent | f89502306dcf6393a2c7b0efbb0fa728fc582137 (diff) | |
parent | 99464bc38e9575ff47f8e33223b252dcea2055e3 (diff) |
Merge #9606: net: Consistently use GetTimeMicros() for inactivity checks
99464bc net: Consistently use GetTimeMicros() for inactivity checks (Suhas Daftuar)
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/misc.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index 54d8c3e035..480c45516c 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -431,22 +431,16 @@ UniValue setmocktime(const JSONRPCRequest& request) if (!Params().MineBlocksOnDemand()) throw runtime_error("setmocktime for regression testing (-regtest mode) only"); - // cs_vNodes is locked and node send/receive times are updated - // atomically with the time change to prevent peers from being - // disconnected because we think we haven't communicated with them - // in a long time. + // 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 + // IsCurrentForFeeEstimation() and IsInitialBlockDownload(). + // TODO: figure out the right way to synchronize around mocktime, and + // ensure all callsites of GetTime() are accessing this safely. LOCK(cs_main); RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VNUM)); SetMockTime(request.params[0].get_int64()); - uint64_t t = GetTime(); - if(g_connman) { - g_connman->ForEachNode([t](CNode* pnode) { - pnode->nLastSend = pnode->nLastRecv = t; - }); - } - return NullUniValue; } |