Also return start and ending height in z_getstats json
This commit is contained in:
@@ -3689,6 +3689,8 @@ UniValue z_getstats(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
int total_ztxs_100_or_more_zins = 0, total_ztxs_100_or_more_zouts = 0;
|
||||
int largest_zins = 0, largest_zouts = 0;
|
||||
std::string largest_zins_txid = "", largest_zouts_txid = "";
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
ret.pushKV("start_height", nHeight);
|
||||
|
||||
// given a single block height, we calculate stats for that height
|
||||
if (params.size() == 1) {
|
||||
@@ -3763,6 +3765,8 @@ UniValue z_getstats(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Ending block height out of range");
|
||||
}
|
||||
|
||||
ret.pushKV("end_height", nHeight2);
|
||||
|
||||
// get the stats for every block in the range
|
||||
for(int currentHeight = nHeight; currentHeight <= nHeight2; currentHeight++) {
|
||||
auto strHash = chainActive[currentHeight]->GetBlockHash().GetHex();
|
||||
@@ -3828,7 +3832,6 @@ UniValue z_getstats(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
}
|
||||
}
|
||||
}
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
double avg_zins = total_ztxs > 0 ? (double) total_zins / total_ztxs : 0.0;
|
||||
double avg_zouts = total_ztxs > 0 ? (double) total_zouts / total_ztxs : 0.0;
|
||||
ret.pushKV("total_ztxs", total_ztxs);
|
||||
|
||||
Reference in New Issue
Block a user