[RPC] disable import functions in pruned mode

import functions could lead to a rescan beyond prune level
This commit is contained in:
Jonas Schnelli 2015-04-24 21:42:51 +02:00 committed by Jack Grigg
parent d510fb4aa4
commit c4447e3df1
No known key found for this signature in database
GPG Key ID: 9E8255172BBF9898
1 changed files with 12 additions and 0 deletions

View File

@ -99,6 +99,9 @@ UniValue importprivkey(const UniValue& params, bool fHelp)
+ HelpExampleRpc("importprivkey", "\"mykey\", \"testing\", false")
);
if (fPruneMode)
throw JSONRPCError(RPC_WALLET_ERROR, "Importing keys is disabled in pruned mode");
LOCK2(cs_main, pwalletMain->cs_wallet);
EnsureWalletIsUnlocked();
@ -167,6 +170,9 @@ UniValue importaddress(const UniValue& params, bool fHelp)
+ HelpExampleRpc("importaddress", "\"myaddress\", \"testing\", false")
);
if (fPruneMode)
throw JSONRPCError(RPC_WALLET_ERROR, "Importing addresses is disabled in pruned mode");
LOCK2(cs_main, pwalletMain->cs_wallet);
CScript script;
@ -265,6 +271,9 @@ UniValue importwallet(const UniValue& params, bool fHelp)
UniValue importwallet_impl(const UniValue& params, bool fHelp, bool fImportZKeys)
{
if (fPruneMode)
throw JSONRPCError(RPC_WALLET_ERROR, "Importing wallets is disabled in pruned mode");
LOCK2(cs_main, pwalletMain->cs_wallet);
EnsureWalletIsUnlocked();
@ -599,6 +608,9 @@ UniValue z_importkey(const UniValue& params, bool fHelp)
+ HelpExampleRpc("z_importkey", "\"mykey\", \"no\"")
);
if (fPruneMode)
throw JSONRPCError(RPC_WALLET_ERROR, "Importing keys is disabled in pruned mode");
LOCK2(cs_main, pwalletMain->cs_wallet);
EnsureWalletIsUnlocked();