Skip to content

Commit 286ec08

Browse files
committed
rpc: Add 'echo' call for testing
This hidden call simply returns what is passed in.
1 parent 495eb44 commit 286ec08

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/rpc/misc.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,17 @@ UniValue getmemoryinfo(const JSONRPCRequest& request)
492492
return obj;
493493
}
494494

495+
UniValue echo(const JSONRPCRequest& request)
496+
{
497+
if (request.fHelp)
498+
throw runtime_error(
499+
"echo \"message\" ...\n"
500+
"\nSimply echo back the input arguments\n"
501+
);
502+
503+
return request.params;
504+
}
505+
495506
static const CRPCCommand commands[] =
496507
{ // category name actor (function) okSafeMode
497508
// --------------------- ------------------------ ----------------------- ----------
@@ -504,6 +515,7 @@ static const CRPCCommand commands[] =
504515

505516
/* Not shown in help */
506517
{ "hidden", "setmocktime", &setmocktime, true },
518+
{ "hidden", "echo", &echo, true, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}},
507519
};
508520

509521
void RegisterMiscRPCCommands(CRPCTable &t)

0 commit comments

Comments
 (0)