Skip to content

Commit

Permalink
permit rpc help even during warmup
Browse files Browse the repository at this point in the history
  • Loading branch information
jmjatlanta committed May 14, 2021
1 parent 7024f9a commit a27b24c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
19 changes: 14 additions & 5 deletions src/rpc/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,12 @@ vector<unsigned char> ParseHexO(const UniValue& o, string strKey)
return ParseHexV(find_value(o, strKey), strKey);
}

/**
* Note: This interface may still be subject to change.
/*****
* Get help on a particular command
* NOTE: This interface may still be subject to change.
* @param strCommand the command (will show all commands if empty)
* @returns contextual help
*/

std::string CRPCTable::help(const std::string& strCommand) const
{
string strRet;
Expand Down Expand Up @@ -848,12 +850,19 @@ std::string JSONRPCExecBatch(const UniValue& vReq)
return ret.write() + "\n";
}

/****
* Execute an RPC method
* @param strMethod the method
* @param params additional parameters to go along with the method
* @returns the results
*/
UniValue CRPCTable::execute(const std::string &strMethod, const UniValue &params) const
{
// Return immediately if in warmup
// Return help text even if chain is not fully warmed up,
// otherwise return immediately
{
LOCK(cs_rpcWarmup);
if (fRPCInWarmup)
if (fRPCInWarmup && strMethod != "help")
throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus);
}

Expand Down
15 changes: 14 additions & 1 deletion src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,12 @@ static void InterpretNegativeSetting(string name, map<string, string>& mapSettin
}
}

/****
* Parse command line parameters,
* place anything that begins with "-" in mapArgs and mapMultiArgs globals
* @param argc number of arguments
* @param argv the arguments
*/
void ParseParameters(int argc, const char* const argv[])
{
mapArgs.clear();
Expand Down Expand Up @@ -387,7 +393,7 @@ void ParseParameters(int argc, const char* const argv[])
}

// New 0.6 features:
BOOST_FOREACH(const PAIRTYPE(string,string)& entry, mapArgs)
for(const auto& entry : mapArgs)
{
// interpret -nofoo as -foo=0 (and -nofoo=0 as -foo=1) as long as -foo not set
InterpretNegativeSetting(entry.first, mapArgs);
Expand Down Expand Up @@ -970,6 +976,9 @@ void RenameThread(const char* name)
#endif
}

/***
* Set up the correct locale (aids in filesystem paths)
*/
void SetupEnvironment()
{
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
Expand All @@ -989,6 +998,10 @@ void SetupEnvironment()
boost::filesystem::path::imbue(loc);
}

/*****
* Initialize networking/socket libraries (i.e. Windows winsock)
* @returns false on failure
*/
bool SetupNetworking()
{
#ifdef _WIN32
Expand Down

0 comments on commit a27b24c

Please sign in to comment.