Merge pull request #168 from fsb4000/translation
[novacoin.git] / src / rpcdump.cpp
index b734eb0..8608463 100644 (file)
@@ -56,6 +56,8 @@ Value importprivkey(const Array& params, bool fHelp)
     key.SetSecret(secret, fCompressed);
     CKeyID vchAddress = key.GetPubKey().GetID();
     {
+        LOCK2(cs_main, pwalletMain->cs_wallet);
+
         pwalletMain->MarkDirty();
         pwalletMain->SetAddressBookName(vchAddress, strLabel);
 
@@ -97,6 +99,7 @@ Value importaddress(const Array& params, bool fHelp)
         fRescan = params[2].get_bool();
 
     {
+        LOCK2(cs_main, pwalletMain->cs_wallet);
         if (::IsMine(*pwalletMain, script) == MINE_SPENDABLE)
             throw JSONRPCError(RPC_WALLET_ERROR, "The wallet already contains the private key for this address or script");
 
@@ -152,6 +155,8 @@ Value removeaddress(const Array& params, bool fHelp)
     if (!pwalletMain->HaveWatchOnly(script))
         throw JSONRPCError(RPC_WALLET_ERROR, "The wallet does not contain this address or script");
 
+    LOCK2(cs_main, pwalletMain->cs_wallet);
+
     pwalletMain->MarkDirty();
 
     if (!pwalletMain->RemoveWatchOnly(script))