@@ -97,8 +97,6 @@ UniValue importprivkey(const UniValue& params, bool fHelp)
9797 + HelpExampleRpc (" importprivkey" , " \" mykey\" , \" testing\" , false" )
9898 );
9999
100- if (fPruneMode )
101- throw JSONRPCError (RPC_WALLET_ERROR, " Importing keys is disabled in pruned mode" );
102100
103101 LOCK2 (cs_main, pwalletMain->cs_wallet );
104102
@@ -114,6 +112,9 @@ UniValue importprivkey(const UniValue& params, bool fHelp)
114112 if (params.size () > 2 )
115113 fRescan = params[2 ].get_bool ();
116114
115+ if (fRescan && fPruneMode )
116+ throw JSONRPCError (RPC_WALLET_ERROR, " Rescan is disabled in pruned mode" );
117+
117118 CBitcoinSecret vchSecret;
118119 bool fGood = vchSecret.SetString (strSecret);
119120
@@ -201,8 +202,6 @@ UniValue importaddress(const UniValue& params, bool fHelp)
201202 + HelpExampleRpc (" importaddress" , " \" myscript\" , \" testing\" , false" )
202203 );
203204
204- if (fPruneMode )
205- throw JSONRPCError (RPC_WALLET_ERROR, " Importing addresses is disabled in pruned mode" );
206205
207206 string strLabel = " " ;
208207 if (params.size () > 1 )
@@ -213,6 +212,9 @@ UniValue importaddress(const UniValue& params, bool fHelp)
213212 if (params.size () > 2 )
214213 fRescan = params[2 ].get_bool ();
215214
215+ if (fRescan && fPruneMode )
216+ throw JSONRPCError (RPC_WALLET_ERROR, " Rescan is disabled in pruned mode" );
217+
216218 // Whether to import a p2sh version, too
217219 bool fP2SH = false ;
218220 if (params.size () > 3 )
@@ -264,8 +266,6 @@ UniValue importpubkey(const UniValue& params, bool fHelp)
264266 + HelpExampleRpc (" importpubkey" , " \" mypubkey\" , \" testing\" , false" )
265267 );
266268
267- if (fPruneMode )
268- throw JSONRPCError (RPC_WALLET_ERROR, " Importing public keys is disabled in pruned mode" );
269269
270270 string strLabel = " " ;
271271 if (params.size () > 1 )
@@ -276,6 +276,9 @@ UniValue importpubkey(const UniValue& params, bool fHelp)
276276 if (params.size () > 2 )
277277 fRescan = params[2 ].get_bool ();
278278
279+ if (fRescan && fPruneMode )
280+ throw JSONRPCError (RPC_WALLET_ERROR, " Rescan is disabled in pruned mode" );
281+
279282 if (!IsHex (params[0 ].get_str ()))
280283 throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Pubkey must be a hex string" );
281284 std::vector<unsigned char > data (ParseHex (params[0 ].get_str ()));
0 commit comments