@@ -1512,6 +1512,7 @@ RPCHelpMan getblockchaininfo()
1512
1512
},
1513
1513
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
1514
1514
{
1515
+ const ArgsManager& args{EnsureAnyArgsman (request.context )};
1515
1516
ChainstateManager& chainman = EnsureAnyChainman (request.context );
1516
1517
LOCK (cs_main);
1517
1518
CChainState& active_chainstate = chainman.ActiveChainstate ();
@@ -1542,7 +1543,7 @@ RPCHelpMan getblockchaininfo()
1542
1543
obj.pushKV (" pruneheight" , block->nHeight );
1543
1544
1544
1545
// if 0, execution bypasses the whole if block.
1545
- bool automatic_pruning = ( gArgs .GetIntArg (" -prune" , 0 ) != 1 ) ;
1546
+ bool automatic_pruning{args .GetIntArg (" -prune" , 0 ) != 1 } ;
1546
1547
obj.pushKV (" automatic_pruning" , automatic_pruning);
1547
1548
if (automatic_pruning) {
1548
1549
obj.pushKV (" prune_target_size" , nPruneTarget);
@@ -2238,10 +2239,9 @@ static RPCHelpMan savemempool()
2238
2239
},
2239
2240
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
2240
2241
{
2242
+ const ArgsManager& args{EnsureAnyArgsman (request.context )};
2241
2243
const CTxMemPool& mempool = EnsureAnyMemPool (request.context );
2242
2244
2243
- const NodeContext& node = EnsureAnyNodeContext (request.context );
2244
-
2245
2245
if (!mempool.IsLoaded ()) {
2246
2246
throw JSONRPCError (RPC_MISC_ERROR, " The mempool was not loaded yet" );
2247
2247
}
@@ -2251,7 +2251,7 @@ static RPCHelpMan savemempool()
2251
2251
}
2252
2252
2253
2253
UniValue ret (UniValue::VOBJ);
2254
- ret.pushKV (" filename" , fs::path ((node. args -> GetDataDirNet () / " mempool.dat" )).u8string ());
2254
+ ret.pushKV (" filename" , fs::path ((args. GetDataDirNet () / " mempool.dat" )).u8string ());
2255
2255
2256
2256
return ret;
2257
2257
},
@@ -2600,10 +2600,11 @@ static RPCHelpMan dumptxoutset()
2600
2600
},
2601
2601
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
2602
2602
{
2603
- const fs::path path = fsbridge::AbsPathJoin (gArgs .GetDataDirNet (), fs::u8path (request.params [0 ].get_str ()));
2603
+ const ArgsManager& args{EnsureAnyArgsman (request.context )};
2604
+ const fs::path path = fsbridge::AbsPathJoin (args.GetDataDirNet (), fs::u8path (request.params [0 ].get_str ()));
2604
2605
// Write to a temporary path and then move into `path` on completion
2605
2606
// to avoid confusion due to an interruption.
2606
- const fs::path temppath = fsbridge::AbsPathJoin (gArgs .GetDataDirNet (), fs::u8path (request.params [0 ].get_str () + " .incomplete" ));
2607
+ const fs::path temppath = fsbridge::AbsPathJoin (args .GetDataDirNet (), fs::u8path (request.params [0 ].get_str () + " .incomplete" ));
2607
2608
2608
2609
if (fs::exists (path)) {
2609
2610
throw JSONRPCError (
0 commit comments