Merge 25ad2c623a into merged_master (Bitcoin PR #18740)

This commit is contained in:
Andrew Poelstra 2020-11-26 01:08:47 +00:00
commit 51965ad1e6
23 changed files with 264 additions and 133 deletions

View file

@ -833,16 +833,16 @@ static bool InitSanityCheck()
return true;
}
static bool AppInitServers()
static bool AppInitServers(const util::Ref& context)
{
RPCServer::OnStarted(&OnRPCStarted);
RPCServer::OnStopped(&OnRPCStopped);
if (!InitHTTPServer())
return false;
StartRPC();
if (!StartHTTPRPC())
if (!StartHTTPRPC(context))
return false;
if (gArgs.GetBoolArg("-rest", DEFAULT_REST_ENABLE)) StartREST();
if (gArgs.GetBoolArg("-rest", DEFAULT_REST_ENABLE)) StartREST(context);
StartHTTPServer();
return true;
}
@ -1289,7 +1289,7 @@ bool AppInitLockDataDirectory()
return true;
}
bool AppInitMain(NodeContext& node)
bool AppInitMain(const util::Ref& context, NodeContext& node)
{
const CChainParams& chainparams = Params();
// ********************************************************* Step 4a: application initialization
@ -1396,7 +1396,6 @@ bool AppInitMain(NodeContext& node)
for (const auto& client : node.chain_clients) {
client->registerRpcs();
}
g_rpc_node = &node;
#if ENABLE_ZMQ
RegisterZMQRPCCommands(tableRPC);
#endif
@ -1412,7 +1411,7 @@ bool AppInitMain(NodeContext& node)
if (gArgs.GetBoolArg("-server", false))
{
uiInterface.InitMessage_connect(SetRPCWarmupStatus);
if (!AppInitServers())
if (!AppInitServers(context))
return InitError(_("Unable to start HTTP server. See debug log for details."));
}