diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-03-13 14:40:53 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-03-13 15:36:15 -0400 |
commit | fac52253f81a4f0d04b25eb4b6c28d04b85ef10b (patch) | |
tree | e3993df152dc5f417cbe85375e903e125a0bae34 /src/rpc/server.cpp | |
parent | fadd99f61032c0b75ad9b198eb5d8e307b0518ee (diff) |
rpc: Document an RPCResult for all calls; Enforce at compile time
Diffstat (limited to 'src/rpc/server.cpp')
-rw-r--r-- | src/rpc/server.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 2893aa0e60..e2618c16da 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -153,6 +153,7 @@ UniValue help(const JSONRPCRequest& jsonRequest) UniValue stop(const JSONRPCRequest& jsonRequest) { + static const std::string RESULT{PACKAGE_NAME " stopping"}; // Accept the deprecated and ignored 'detach' boolean argument // Also accept the hidden 'wait' integer argument (milliseconds) // For instance, 'stop 1000' makes the call wait 1 second before returning @@ -162,7 +163,7 @@ UniValue stop(const JSONRPCRequest& jsonRequest) RPCHelpMan{"stop", "\nRequest a graceful shutdown of " PACKAGE_NAME ".", {}, - RPCResults{}, + RPCResult{RPCResult::Type::STR, "", "A string with the content '" + RESULT + "'"}, RPCExamples{""}, }.ToString()); // Event loop will exit after current HTTP requests have been handled, so @@ -171,7 +172,7 @@ UniValue stop(const JSONRPCRequest& jsonRequest) if (jsonRequest.params[0].isNum()) { UninterruptibleSleep(std::chrono::milliseconds{jsonRequest.params[0].get_int()}); } - return PACKAGE_NAME " stopping"; + return RESULT; } static UniValue uptime(const JSONRPCRequest& jsonRequest) |