message: rpc: Use EnsureAnyArgsman in rpc/blockchain
diff: @@ -1439,6 +1439,7 @@ RPCHelpMan getblockchaininfo()
  },
  [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
  {
  + const ArgsManager& args{EnsureAnyArgsman(request.context)};
  ChainstateManager& chainman = EnsureAnyChainman(request.context);
  LOCK(cs_main);
  CChainState& active_chainstate = chainman.ActiveChainstate();
  @@ -2141,10 +2142,9 @@ static RPCHelpMan savemempool()
  },
  [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
  {
  + const ArgsManager& args{EnsureAnyArgsman(request.context)};
  const CTxMemPool& mempool = EnsureAnyMemPool(request.context);
  - const NodeContext& node = EnsureAnyNodeContext(request.context);
  -
  if (!mempool.IsLoaded()) {
  throw JSONRPCError(RPC_MISC_ERROR, "The mempool was not loaded yet");
  }
  @@ -2154,7 +2154,7 @@ static RPCHelpMan savemempool()
  }
  UniValue ret(UniValue::VOBJ);
  - ret.pushKV("filename", fs::path((node.args->GetDataDirNet() / "mempool.dat")).u8string());
  + ret.pushKV("filename", fs::path((args.GetDataDirNet() / "mempool.dat")).u8string());
  return ret;
  },
  @@ -2499,10 +2499,11 @@ static RPCHelpMan dumptxoutset()
  },
  [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
  {
  - const fs::path path = fsbridge::AbsPathJoin(gArgs.GetDataDirNet(), fs::u8path(request.params[0].get_str()));
  + const ArgsManager& args{EnsureAnyArgsman(request.context)};
  + const fs::path path = fsbridge::AbsPathJoin(args.GetDataDirNet(), fs::u8path(request.params[0].get_str()));
  // Write to a temporary path and then move into `path` on completion
  // to avoid confusion due to an interruption.
  - const fs::path temppath = fsbridge::AbsPathJoin(gArgs.GetDataDirNet(), fs::u8path(request.params[0].get_str() + ".incomplete"));
  + const fs::path temppath = fsbridge::AbsPathJoin(args.GetDataDirNet(), fs::u8path(request.params[0].get_str() + ".incomplete"));
  if (fs::exists(path)) {
  throw JSONRPCError(
  