Apply suggestions from code review

Co-authored-by: Larry Ruane <larry@z.cash>
This commit is contained in:
ying tong 2020-10-17 13:27:38 +08:00 committed by GitHub
parent 4e50b700e9
commit e60c2bf17c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -915,7 +915,7 @@ UniValue getblocksubsidy(const UniValue& params, bool fHelp)
UniValue fundingstreams(UniValue::VARR);
auto fsinfos = Consensus::GetActiveFundingStreams(nHeight, consensus);
for (int idx = 0; idx < fsinfos.size(); idx++) {
auto fsinfo = fsinfos[idx];
const auto& fsinfo = fsinfos[idx];
CAmount nStreamAmount = fsinfo.Value(nBlockSubsidy);
nMinerReward -= nStreamAmount;
@ -929,15 +929,17 @@ UniValue getblocksubsidy(const UniValue& params, bool fHelp)
auto address = fs.get().RecipientAddress(consensus, nHeight);
CScript* outpoint = boost::get<CScript>(&address);
libzcash::SaplingPaymentAddress* zaddr = boost::get<libzcash::SaplingPaymentAddress>(&address);
UniValue pubkey(UniValue::VOBJ);
if (outpoint != nullptr) {
// For transparent funding stream addresses
ScriptPubKeyToJSON(*outpoint, pubkey, true);
} else if (zaddr != nullptr) {
// For shielded funding stream addresses
pubkey.pushKV("address", keyIO.EncodePaymentAddress(*zaddr));
} else {
libzcash::SaplingPaymentAddress* zaddr = boost::get<libzcash::SaplingPaymentAddress>(&address);
if (zaddr != nullptr) {
// For shielded funding stream addresses
pubkey.pushKV("address", keyIO.EncodePaymentAddress(*zaddr));
}
}
fsobj.pushKV("pubkey", pubkey);