Allow hush-cli stop to be run during RPC warmup, thanks to @zancas for the idea
This commit is contained in:
@@ -858,20 +858,25 @@ std::string JSONRPCExecBatch(const UniValue& vReq)
|
||||
|
||||
UniValue CRPCTable::execute(const std::string &strMethod, const UniValue ¶ms) const
|
||||
{
|
||||
// Return immediately if in warmup
|
||||
{
|
||||
LOCK(cs_rpcWarmup);
|
||||
if (fRPCInWarmup)
|
||||
throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus);
|
||||
}
|
||||
|
||||
//printf("RPC call: %s\n", strMethod.c_str());
|
||||
|
||||
// Find method
|
||||
const CRPCCommand *pcmd = tableRPC[strMethod];
|
||||
if (!pcmd)
|
||||
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found");
|
||||
|
||||
// Return immediately if in warmup
|
||||
{
|
||||
LOCK(cs_rpcWarmup);
|
||||
if (fRPCInWarmup) {
|
||||
// hush-cli stop is the only valid RPC command during warmup
|
||||
// We don't know if we have valid blocks or wallet yet, nothing else is safe
|
||||
if (pcmd->name != "stop") {
|
||||
throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//printf("RPC call: %s\n", strMethod.c_str());
|
||||
|
||||
g_rpcSignals.PreCommand(*pcmd);
|
||||
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user