From be9aec60fd829c97c5f9baf5d07a3d5ca89e9594 Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Mon, 1 Jun 2020 12:59:40 -0300 Subject: [PATCH] add address to z_importviewingkey error --- src/wallet/rpcdump.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index dbbad1714..40932e435 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -839,14 +839,15 @@ UniValue z_importviewingkey(const UniValue& params, bool fHelp) auto addrInfo = boost::apply_visitor(libzcash::AddressInfoFromViewingKey{}, viewingkey); UniValue result(UniValue::VOBJ); + const string strAddress = EncodePaymentAddress(addrInfo.second); result.pushKV("type", addrInfo.first); - result.pushKV("address", 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; }