mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
Merge pull request #5711
5ebe095Trim RPC command table (Wladimir J. van der Laan)4401b2dRemoved main.h dependency from rpcserver.cpp (Eric Lombrozo)
This commit is contained in:
22
src/init.cpp
22
src/init.cpp
@@ -234,6 +234,26 @@ bool static Bind(const CService &addr, unsigned int flags) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnRPCStopped()
|
||||
{
|
||||
cvBlockChange.notify_all();
|
||||
LogPrint("rpc", "RPC stopped.\n");
|
||||
}
|
||||
|
||||
void OnRPCPreCommand(const CRPCCommand& cmd)
|
||||
{
|
||||
#ifdef ENABLE_WALLET
|
||||
if (cmd.reqWallet && !pwalletMain)
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (disabled)");
|
||||
#endif
|
||||
|
||||
// Observe safe mode
|
||||
string strWarning = GetWarnings("rpc");
|
||||
if (strWarning != "" && !GetBoolArg("-disablesafemode", false) &&
|
||||
!cmd.okSafeMode)
|
||||
throw JSONRPCError(RPC_FORBIDDEN_BY_SAFE_MODE, string("Safe mode: ") + strWarning);
|
||||
}
|
||||
|
||||
std::string HelpMessage(HelpMessageMode mode)
|
||||
{
|
||||
// When adding new options to the categories, please keep and ensure alphabetical ordering.
|
||||
@@ -802,6 +822,8 @@ bool AppInit2(boost::thread_group& threadGroup)
|
||||
if (fServer)
|
||||
{
|
||||
uiInterface.InitMessage.connect(SetRPCWarmupStatus);
|
||||
RPCServer::OnStopped(&OnRPCStopped);
|
||||
RPCServer::OnPreCommand(&OnRPCPreCommand);
|
||||
StartRPCThreads();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user