Remove uses of fPruneMode in wallet code

This commit does not change behavior.
pull/764/head
Russell Yanofsky 7 years ago
parent cc02c796d3
commit cc3836e8f9

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

@ -155,6 +155,9 @@ public:
//! Pool min fee. //! Pool min fee.
virtual CFeeRate mempoolMinFee() = 0; 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 //! Interface to let node manage chain clients (wallets, or maybe tools for

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

@ -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 //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 //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 // or if he ran -disablewallet for a longer time, then decided to re-enable
if (fPruneMode) if (chain.getPruneMode())
{ {
int block_height = *tip_height; int block_height = *tip_height;
while (block_height > 0 && locked_chain->haveBlockOnDisk(block_height - 1) && rescan_height != block_height) { while (block_height > 0 && locked_chain->haveBlockOnDisk(block_height - 1) && rescan_height != block_height) {

Loading…
Cancel
Save