[tests pass] Ensure `importprivkey` outputs the address in case key is already imported.

This commit is contained in:
Nathan Wilcox 2017-09-18 15:29:10 +09:00
parent 3e92c028ce
commit de422c066b
1 changed files with 3 additions and 2 deletions

View File

@ -128,8 +128,9 @@ UniValue importprivkey(const UniValue& params, bool fHelp)
pwalletMain->SetAddressBook(vchAddress, strLabel, "receive");
// Don't throw error in case a key is already there
if (pwalletMain->HaveKey(vchAddress))
return NullUniValue;
if (pwalletMain->HaveKey(vchAddress)) {
return CBitcoinAddress(vchAddress).ToString();
}
pwalletMain->mapKeyMetadata[vchAddress].nCreateTime = 1;