aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/misc.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2017-12-05 15:57:12 -0500
committerRussell Yanofsky <russ@yanofsky.org>2020-02-25 05:50:39 -0500
commit1dde238f2c21a0cc9bada10a2449cf9c6b2178ad (patch)
tree26269cc1ac164d0ef0ebc442b334ad58fe7a2119 /src/rpc/misc.cpp
parent31c0006a6cd5ecbabd119eaf9dae6978aa54f150 (diff)
Add ChainClient setMockTime, getWallets methods
Needed to set mock times, and get wallet interface pointers correctly when wallet code is running in a different process from node code.
Diffstat (limited to 'src/rpc/misc.cpp')
-rw-r--r--src/rpc/misc.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp
index 4279756f4d..778bd05dad 100644
--- a/src/rpc/misc.cpp
+++ b/src/rpc/misc.cpp
@@ -4,6 +4,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <httpserver.h>
+#include <interfaces/chain.h>
#include <key_io.h>
#include <node/context.h>
#include <outputtype.h>
@@ -356,7 +357,13 @@ static UniValue setmocktime(const JSONRPCRequest& request)
LOCK(cs_main);
RPCTypeCheck(request.params, {UniValue::VNUM});
- SetMockTime(request.params[0].get_int64());
+ int64_t time = request.params[0].get_int64();
+ SetMockTime(time);
+ if (g_rpc_node) {
+ for (const auto& chain_client : g_rpc_node->chain_clients) {
+ chain_client->setMockTime(time);
+ }
+ }
return NullUniValue;
}