Skip to content

Commit

Permalink
rpc: Add 'echo' call for testing
Browse files Browse the repository at this point in the history
This hidden call simply returns what is passed in.
  • Loading branch information
laanwj authored and random-zebra committed May 25, 2021
1 parent f8617c2 commit 4b2b980
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/rpc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
// --------------------- ------------------------ ----------------------- ----------
Expand All @@ -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)
Expand Down

0 comments on commit 4b2b980

Please sign in to comment.