add random and ping

This commit is contained in:
CJ Cobb
2021-09-17 15:30:36 -04:00
parent 5f23a5803b
commit 3d580784d1
5 changed files with 42 additions and 3 deletions

View File

@@ -110,7 +110,8 @@ static std::unordered_map<std::string, std::function<Result(Context const&)>>
{"server_info", &doServerInfo},
{"unsubscribe", &doUnsubscribe},
{"tx", &doTx},
{"transaction_entry", &doTransactionEntry}};
{"transaction_entry", &doTransactionEntry},
{"random", &doRandom}};
static std::unordered_set<std::string> forwardCommands{
"submit",
@@ -155,6 +156,8 @@ buildResponse(Context const& ctx)
return Status{Error::rpcFAILED_TO_FORWARD};
return res;
}
if (ctx.method == "ping")
return boost::json::object{};
if (handlerTable.find(ctx.method) == handlerTable.end())
return Status{Error::rpcUNKNOWN_COMMAND};