Browse Source

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.
pull/4/head
Jack Grigg 7 years ago
parent
commit
7b8d4f87ec
No known key found for this signature in database GPG Key ID: 665DBCD284F7DAFF
  1. 11
      src/wallet/rpcwallet.cpp

11
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;
}

Loading…
Cancel
Save