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.
This commit is contained in:
parent
44e37656bf
commit
7b8d4f87ec
|
@ -2902,26 +2902,23 @@ UniValue zc_raw_keygen(const UniValue& params, bool fHelp)
|
||||||
"Output: {\n"
|
"Output: {\n"
|
||||||
" \"zcaddress\": zcaddr,\n"
|
" \"zcaddress\": zcaddr,\n"
|
||||||
" \"zcsecretkey\": zcsecretkey,\n"
|
" \"zcsecretkey\": zcsecretkey,\n"
|
||||||
|
" \"zcviewingkey\": zcviewingkey,\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto k = SpendingKey::random();
|
auto k = SpendingKey::random();
|
||||||
auto addr = k.address();
|
auto addr = k.address();
|
||||||
auto receiving_key = k.receiving_key();
|
auto viewing_key = k.viewing_key();
|
||||||
|
|
||||||
CDataStream receiving(SER_NETWORK, PROTOCOL_VERSION);
|
|
||||||
|
|
||||||
receiving << receiving_key;
|
|
||||||
|
|
||||||
CZCPaymentAddress pubaddr(addr);
|
CZCPaymentAddress pubaddr(addr);
|
||||||
CZCSpendingKey spendingkey(k);
|
CZCSpendingKey spendingkey(k);
|
||||||
std::string receiving_hex = HexStr(receiving.begin(), receiving.end());
|
CZCViewingKey viewingkey(viewing_key);
|
||||||
|
|
||||||
UniValue result(UniValue::VOBJ);
|
UniValue result(UniValue::VOBJ);
|
||||||
result.push_back(Pair("zcaddress", pubaddr.ToString()));
|
result.push_back(Pair("zcaddress", pubaddr.ToString()));
|
||||||
result.push_back(Pair("zcsecretkey", spendingkey.ToString()));
|
result.push_back(Pair("zcsecretkey", spendingkey.ToString()));
|
||||||
result.push_back(Pair("zcviewingkey", receiving_hex));
|
result.push_back(Pair("zcviewingkey", viewingkey.ToString()));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue