From 4b2b9808388fdc48e2abd79008f14e3763232db9 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sun, 25 Sep 2016 20:55:24 +0200 Subject: [PATCH] rpc: Add 'echo' call for testing This hidden call simply returns what is passed in. --- src/rpc/misc.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index bd7ec3e0e73ba..470b4f5a5bd72 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -750,6 +750,17 @@ UniValue getmemoryinfo(const JSONRPCRequest& request) return obj; } +UniValue echo(const JSONRPCRequest& request) +{ + if (request.fHelp) + throw std::runtime_error( + "echo \"message\" ...\n" + "\nSimply echo back the input arguments\n" + ); + + return request.params; +} + static const CRPCCommand commands[] = { // category name actor (function) okSafeMode // --------------------- ------------------------ ----------------------- ---------- @@ -764,6 +775,7 @@ static const CRPCCommand commands[] = /* Not shown in help */ { "hidden", "setmocktime", &setmocktime, true }, + { "hidden", "echo", &echo, true, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}}, }; void RegisterMiscRPCCommands(CRPCTable &tableRPC)