Remove uses of fPruneMode in wallet code

This commit does not change behavior.
This commit is contained in:
Russell Yanofsky 2017-07-28 22:45:01 -04:00
parent cc02c796d3
commit cc3836e8f9
4 changed files with 9 additions and 5 deletions

View file

@ -228,6 +228,7 @@ public:
{
return ::mempool.GetMinFee(gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000);
}
bool getPruneMode() override { return ::fPruneMode; }
};
} // namespace

View file

@ -155,6 +155,9 @@ public:
//! Pool min fee.
virtual CFeeRate mempoolMinFee() = 0;
//! Check if pruning is enabled.
virtual bool getPruneMode() = 0;
};
//! Interface to let node manage chain clients (wallets, or maybe tools for

View file

@ -157,7 +157,7 @@ UniValue importprivkey(const JSONRPCRequest& request)
if (!request.params[2].isNull())
fRescan = request.params[2].get_bool();
if (fRescan && fPruneMode)
if (fRescan && pwallet->chain().getPruneMode())
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
if (fRescan && !reserver.reserve()) {
@ -313,7 +313,7 @@ UniValue importaddress(const JSONRPCRequest& request)
if (!request.params[2].isNull())
fRescan = request.params[2].get_bool();
if (fRescan && fPruneMode)
if (fRescan && pwallet->chain().getPruneMode())
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
WalletRescanReserver reserver(pwallet);
@ -501,7 +501,7 @@ UniValue importpubkey(const JSONRPCRequest& request)
if (!request.params[2].isNull())
fRescan = request.params[2].get_bool();
if (fRescan && fPruneMode)
if (fRescan && pwallet->chain().getPruneMode())
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
WalletRescanReserver reserver(pwallet);
@ -562,7 +562,7 @@ UniValue importwallet(const JSONRPCRequest& request)
},
}.ToString());
if (fPruneMode)
if (pwallet->chain().getPruneMode())
throw JSONRPCError(RPC_WALLET_ERROR, "Importing wallets is disabled in pruned mode");
WalletRescanReserver reserver(pwallet);

View file

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