Skip to content

Commit 7a12119

Browse files
committed
[RPC] disable import functions in pruned mode
import functions could lead to a rescan beyond prune level
1 parent 3201035 commit 7a12119

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/wallet/rpcdump.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ Value importprivkey(const Array& params, bool fHelp)
9595
+ HelpExampleRpc("importprivkey", "\"mykey\", \"testing\", false")
9696
);
9797

98+
if (fPruneMode)
99+
throw JSONRPCError(RPC_WALLET_ERROR, "Importing keys is disabled in pruned mode");
100+
98101
LOCK2(cs_main, pwalletMain->cs_wallet);
99102

100103
EnsureWalletIsUnlocked();
@@ -167,6 +170,9 @@ Value importaddress(const Array& params, bool fHelp)
167170
+ HelpExampleRpc("importaddress", "\"myaddress\", \"testing\", false")
168171
);
169172

173+
if (fPruneMode)
174+
throw JSONRPCError(RPC_WALLET_ERROR, "Importing addresses is disabled in pruned mode");
175+
170176
LOCK2(cs_main, pwalletMain->cs_wallet);
171177

172178
CScript script;
@@ -237,6 +243,9 @@ Value importwallet(const Array& params, bool fHelp)
237243
+ HelpExampleRpc("importwallet", "\"test\"")
238244
);
239245

246+
if (fPruneMode)
247+
throw JSONRPCError(RPC_WALLET_ERROR, "Importing wallets is disabled in pruned mode");
248+
240249
LOCK2(cs_main, pwalletMain->cs_wallet);
241250

242251
EnsureWalletIsUnlocked();

0 commit comments

Comments
 (0)