From e60c2bf17caa006a391fb7e71ba0aece9b303517 Mon Sep 17 00:00:00 2001 From: ying tong Date: Sat, 17 Oct 2020 13:27:38 +0800 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Larry Ruane --- src/rpc/mining.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index f6c55620e..70af9c311 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -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(&address); - libzcash::SaplingPaymentAddress* zaddr = boost::get(&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(&address); + if (zaddr != nullptr) { + // For shielded funding stream addresses + pubkey.pushKV("address", keyIO.EncodePaymentAddress(*zaddr)); + } } fsobj.pushKV("pubkey", pubkey);