@@ -464,7 +464,7 @@ static RPCHelpMan getblockfrompeer()
464464
465465 // Fetching blocks before the node has syncing past their height can prevent block files from
466466 // being pruned, so we avoid it if the node is in prune mode.
467- if (node:: fPruneMode && index->nHeight > WITH_LOCK (chainman.GetMutex (), return chainman.ActiveTip ()->nHeight )) {
467+ if (chainman. m_blockman . IsPruneMode () && index->nHeight > WITH_LOCK (chainman.GetMutex (), return chainman.ActiveTip ()->nHeight )) {
468468 throw JSONRPCError (RPC_MISC_ERROR, " In prune mode, only blocks that the node has already synced previously can be fetched from a peer" );
469469 }
470470
@@ -778,10 +778,11 @@ static RPCHelpMan pruneblockchain()
778778 },
779779 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
780780{
781- if (!node::fPruneMode )
781+ ChainstateManager& chainman = EnsureAnyChainman (request.context );
782+ if (!chainman.m_blockman .IsPruneMode ()) {
782783 throw JSONRPCError (RPC_MISC_ERROR, " Cannot prune blocks because node is not in prune mode." );
784+ }
783785
784- ChainstateManager& chainman = EnsureAnyChainman (request.context );
785786 LOCK (cs_main);
786787 Chainstate& active_chainstate = chainman.ActiveChainstate ();
787788 CChain& active_chain = active_chainstate.m_chain ;
@@ -1265,8 +1266,8 @@ RPCHelpMan getblockchaininfo()
12651266 obj.pushKV (" initialblockdownload" , active_chainstate.IsInitialBlockDownload ());
12661267 obj.pushKV (" chainwork" , tip.nChainWork .GetHex ());
12671268 obj.pushKV (" size_on_disk" , chainman.m_blockman .CalculateCurrentUsage ());
1268- obj.pushKV (" pruned" , node:: fPruneMode );
1269- if (node:: fPruneMode ) {
1269+ obj.pushKV (" pruned" , chainman. m_blockman . IsPruneMode () );
1270+ if (chainman. m_blockman . IsPruneMode () ) {
12701271 obj.pushKV (" pruneheight" , chainman.m_blockman .GetFirstStoredBlock (tip)->nHeight );
12711272
12721273 // if 0, execution bypasses the whole if block.
0 commit comments