Skip to content

Commit cc3836e

Browse files
committed
Remove uses of fPruneMode in wallet code
This commit does not change behavior.
1 parent cc02c79 commit cc3836e

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

src/interfaces/chain.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ class ChainImpl : public Chain
228228
{
229229
return ::mempool.GetMinFee(gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000);
230230
}
231+
bool getPruneMode() override { return ::fPruneMode; }
231232
};
232233

233234
} // namespace

src/interfaces/chain.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ class Chain
155155

156156
//! Pool min fee.
157157
virtual CFeeRate mempoolMinFee() = 0;
158+
159+
//! Check if pruning is enabled.
160+
virtual bool getPruneMode() = 0;
158161
};
159162

160163
//! Interface to let node manage chain clients (wallets, or maybe tools for

src/wallet/rpcdump.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ UniValue importprivkey(const JSONRPCRequest& request)
157157
if (!request.params[2].isNull())
158158
fRescan = request.params[2].get_bool();
159159

160-
if (fRescan && fPruneMode)
160+
if (fRescan && pwallet->chain().getPruneMode())
161161
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
162162

163163
if (fRescan && !reserver.reserve()) {
@@ -313,7 +313,7 @@ UniValue importaddress(const JSONRPCRequest& request)
313313
if (!request.params[2].isNull())
314314
fRescan = request.params[2].get_bool();
315315

316-
if (fRescan && fPruneMode)
316+
if (fRescan && pwallet->chain().getPruneMode())
317317
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
318318

319319
WalletRescanReserver reserver(pwallet);
@@ -501,7 +501,7 @@ UniValue importpubkey(const JSONRPCRequest& request)
501501
if (!request.params[2].isNull())
502502
fRescan = request.params[2].get_bool();
503503

504-
if (fRescan && fPruneMode)
504+
if (fRescan && pwallet->chain().getPruneMode())
505505
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
506506

507507
WalletRescanReserver reserver(pwallet);
@@ -562,7 +562,7 @@ UniValue importwallet(const JSONRPCRequest& request)
562562
},
563563
}.ToString());
564564

565-
if (fPruneMode)
565+
if (pwallet->chain().getPruneMode())
566566
throw JSONRPCError(RPC_WALLET_ERROR, "Importing wallets is disabled in pruned mode");
567567

568568
WalletRescanReserver reserver(pwallet);

src/wallet/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4334,7 +4334,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
43344334
//We can't rescan beyond non-pruned blocks, stop and throw an error
43354335
//this might happen if a user uses an old wallet within a pruned node
43364336
// or if he ran -disablewallet for a longer time, then decided to re-enable
4337-
if (fPruneMode)
4337+
if (chain.getPruneMode())
43384338
{
43394339
int block_height = *tip_height;
43404340
while (block_height > 0 && locked_chain->haveBlockOnDisk(block_height - 1) && rescan_height != block_height) {

0 commit comments

Comments
 (0)