Don't mark wallet as dirty if key already exists.
Fix incorrect method name used in error message.
This commit is contained in:
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user