diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 2927ab5c1..64be2b362 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -850,14 +850,15 @@ UniValue z_importviewingkey(const UniValue& params, bool fHelp) auto addrInfo = boost::apply_visitor(libzcash::AddressInfoFromViewingKey{}, viewingkey); UniValue result(UniValue::VOBJ); + const string strAddress = keyIO.EncodePaymentAddress(addrInfo.second); result.pushKV("type", addrInfo.first); - result.pushKV("address", keyIO.EncodePaymentAddress(addrInfo.second)); + result.pushKV("address", strAddress); auto addResult = boost::apply_visitor(AddViewingKeyToWallet(pwalletMain), viewingkey); if (addResult == SpendingKeyExists) { throw JSONRPCError( RPC_WALLET_ERROR, - "The wallet already contains the private key for this viewing key"); + "The wallet already contains the private key for this viewing key (address: " + strAddress + ")"); } else if (addResult == KeyAlreadyExists && fIgnoreExistingKey) { return result; }