diff --git a/src/rpc/server.h b/src/rpc/server.h --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -225,8 +225,7 @@ /** * Appends a CRPCCommand to the dispatch table. * - * Returns false if RPC server is already running (dump concurrency - * protection). + * Precondition: RPC server is not running * * Commands with different method names but the same unique_id will * be considered aliases, and only the first registered method name will @@ -235,7 +234,7 @@ * between calls based on method name, and aliased commands can also * register different names, types, and numbers of parameters. */ - bool appendCommand(const std::string &name, const CRPCCommand *pcmd); + void appendCommand(const std::string &name, const CRPCCommand *pcmd); bool removeCommand(const std::string &name, const CRPCCommand *pcmd); }; diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -315,14 +315,12 @@ } } -bool CRPCTable::appendCommand(const std::string &name, +void CRPCTable::appendCommand(const std::string &name, const CRPCCommand *pcmd) { - if (IsRPCRunning()) { - return false; - } + // Only add commands before rpc is running + CHECK_NONFATAL(!IsRPCRunning()); mapCommands[name].push_back(pcmd); - return true; } bool CRPCTable::removeCommand(const std::string &name,