Don't mark wallet as dirty if key already exists.

Fix incorrect method name used in error message.
This commit is contained in:
Simon
2016-08-11 11:37:00 -07:00
parent 4cea36bef3
commit 0feffd1424
2 changed files with 4 additions and 4 deletions

View File

@@ -565,12 +565,12 @@ Value z_importkey(const Array& params, bool fHelp)
auto addr = key.address();
{
pwalletMain->MarkDirty();
// Don't throw error in case a key is already there
if (pwalletMain->HaveSpendingKey(addr))
return Value::null;
pwalletMain->MarkDirty();
if (!pwalletMain-> AddZKey(key))
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding spending key to wallet");