From 7b8d4f87ec9c9d1988debf124739fbb95da55b8d Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Mon, 18 Dec 2017 16:09:43 +0000 Subject: [PATCH] Modify zcrawkeygen RPC method to set "zcviewingkey" to the viewing key The "zcviewingkey" field has never been documented before, and the method itself is deprecated; this just ensures it is consistent with the rest of the RPC. --- src/wallet/rpcwallet.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 4e0a798ac..696c71c71 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2902,26 +2902,23 @@ UniValue zc_raw_keygen(const UniValue& params, bool fHelp) "Output: {\n" " \"zcaddress\": zcaddr,\n" " \"zcsecretkey\": zcsecretkey,\n" + " \"zcviewingkey\": zcviewingkey,\n" "}\n" ); } auto k = SpendingKey::random(); auto addr = k.address(); - auto receiving_key = k.receiving_key(); - - CDataStream receiving(SER_NETWORK, PROTOCOL_VERSION); - - receiving << receiving_key; + auto viewing_key = k.viewing_key(); CZCPaymentAddress pubaddr(addr); CZCSpendingKey spendingkey(k); - std::string receiving_hex = HexStr(receiving.begin(), receiving.end()); + CZCViewingKey viewingkey(viewing_key); UniValue result(UniValue::VOBJ); result.push_back(Pair("zcaddress", pubaddr.ToString())); result.push_back(Pair("zcsecretkey", spendingkey.ToString())); - result.push_back(Pair("zcviewingkey", receiving_hex)); + result.push_back(Pair("zcviewingkey", viewingkey.ToString())); return result; }