aboutsummaryrefslogtreecommitdiff
path: root/src/rpcdump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpcdump.cpp')
-rw-r--r--src/rpcdump.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp
index 1ac7024550..9da0a7d091 100644
--- a/src/rpcdump.cpp
+++ b/src/rpcdump.cpp
@@ -114,8 +114,6 @@ Value importprivkey(const Array& params, bool fHelp)
CPubKey pubkey = key.GetPubKey();
CKeyID vchAddress = pubkey.GetID();
{
- LOCK2(cs_main, pwalletMain->cs_wallet);
-
pwalletMain->MarkDirty();
pwalletMain->SetAddressBook(vchAddress, strLabel, "receive");
@@ -181,7 +179,8 @@ Value importaddress(const Array& params, bool fHelp)
fRescan = params[2].get_bool();
{
- LOCK2(cs_main, pwalletMain->cs_wallet);
+ if (::IsMine(*pwalletMain, script) == ISMINE_SPENDABLE)
+ throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script");
// add to address book or update label
if (address.IsValid())