mirror of
https://git.hush.is/hush/hush3.git
synced 2025-07-18 00:03:31 -04:00
Compare commits
No commits in common. "4aca3493e39910d5e75bf84f5455a16303180ea2" and "7ea88bb303372eb91bebb0da908ce6ac0c484de0" have entirely different histories.
4aca3493e3
...
7ea88bb303
@ -3683,12 +3683,7 @@ UniValue z_getstats(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
|||||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk");
|
throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk");
|
||||||
|
|
||||||
int total_ztxs = 0, total_zins = 0, total_zouts = 0;
|
int total_ztxs = 0, total_zins = 0, total_zouts = 0;
|
||||||
int total_ztxs_10_or_more_zins = 0, total_ztxs_10_or_more_zouts = 0;
|
|
||||||
int total_ztxs_25_or_more_zins = 0, total_ztxs_25_or_more_zouts = 0;
|
|
||||||
int total_ztxs_50_or_more_zins = 0, total_ztxs_50_or_more_zouts = 0;
|
|
||||||
int total_ztxs_100_or_more_zins = 0, total_ztxs_100_or_more_zouts = 0;
|
|
||||||
int largest_zins = 0, largest_zouts = 0;
|
int largest_zins = 0, largest_zouts = 0;
|
||||||
std::string largest_zins_txid = "", largest_zouts_txid = "";
|
|
||||||
|
|
||||||
// given a single block height, we calculate stats for that height
|
// given a single block height, we calculate stats for that height
|
||||||
if (params.size() == 1) {
|
if (params.size() == 1) {
|
||||||
@ -3700,53 +3695,24 @@ UniValue z_getstats(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
|||||||
num_zouts = tx.vShieldedOutput.size();
|
num_zouts = tx.vShieldedOutput.size();
|
||||||
num_zins = tx.vShieldedSpend.size();
|
num_zins = tx.vShieldedSpend.size();
|
||||||
// tx must have some zins and zouts to count towards our stats,
|
// tx must have some zins and zouts to count towards our stats,
|
||||||
// which ignores shielding coinbase txs, which have only transparent inputs.
|
// which ignores shielding coinbase txs, which have only transparent inputs
|
||||||
// This mostly will only count "z2z" txs but also counts (z,t)=>z and z=>(z,t)
|
// This mostly will only count "z2z" txs but also counts (z,t)=>z and z=>(z,t)
|
||||||
// which are possible but unlikely, since RPCs cannot currently create (z,t)=>z txs
|
// which are possible but unlikely, since RPCs will not create them
|
||||||
// and z=>(z,t) are disallowed when ac_private=1
|
|
||||||
if(num_zins > 0 && num_zouts > 0) {
|
if(num_zins > 0 && num_zouts > 0) {
|
||||||
total_ztxs++;
|
total_ztxs++;
|
||||||
total_zins += num_zins;
|
total_zins += num_zins;
|
||||||
total_zouts += num_zouts;
|
total_zouts += num_zouts;
|
||||||
if (num_zins > largest_zins) {
|
if (num_zins > largest_zins) {
|
||||||
largest_zins = num_zins;
|
largest_zins = num_zins;
|
||||||
largest_zins_txid = tx.GetHash().ToString();
|
|
||||||
}
|
}
|
||||||
if (num_zouts > largest_zouts) {
|
if (num_zouts > largest_zouts) {
|
||||||
largest_zouts = num_zouts;
|
largest_zouts = num_zouts;
|
||||||
largest_zouts_txid = tx.GetHash().ToString();
|
|
||||||
}
|
}
|
||||||
if (num_zins >= 10) {
|
|
||||||
total_ztxs_10_or_more_zins++;
|
|
||||||
if (num_zins >= 25) {
|
|
||||||
total_ztxs_25_or_more_zins++;
|
|
||||||
if (num_zins >= 50) {
|
|
||||||
total_ztxs_50_or_more_zins++;
|
|
||||||
if (num_zins >= 100) {
|
|
||||||
total_ztxs_100_or_more_zins++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (num_zouts >= 10) {
|
|
||||||
total_ztxs_10_or_more_zouts++;
|
|
||||||
if (num_zouts >= 25) {
|
|
||||||
total_ztxs_25_or_more_zouts++;
|
|
||||||
if (num_zouts >= 50) {
|
|
||||||
total_ztxs_50_or_more_zouts++;
|
|
||||||
if (num_zouts >= 100) {
|
|
||||||
total_ztxs_100_or_more_zouts++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// given two blocks, we calculate stats for that range
|
// given two blocks, we calculate delta for that range
|
||||||
std::string strHeight2 = params[1].get_str();
|
std::string strHeight2 = params[1].get_str();
|
||||||
int nHeight2 = -1;
|
int nHeight2 = -1;
|
||||||
try {
|
try {
|
||||||
@ -3763,7 +3729,7 @@ UniValue z_getstats(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
|||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Ending block height out of range");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Ending block height out of range");
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the stats for every block in the range
|
// get the delta for every block in the range
|
||||||
for(int currentHeight = nHeight; currentHeight <= nHeight2; currentHeight++) {
|
for(int currentHeight = nHeight; currentHeight <= nHeight2; currentHeight++) {
|
||||||
auto strHash = chainActive[currentHeight]->GetBlockHash().GetHex();
|
auto strHash = chainActive[currentHeight]->GetBlockHash().GetHex();
|
||||||
uint256 hash(uint256S(strHash));
|
uint256 hash(uint256S(strHash));
|
||||||
@ -3794,35 +3760,9 @@ UniValue z_getstats(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
|||||||
}
|
}
|
||||||
if (num_zins > largest_zins) {
|
if (num_zins > largest_zins) {
|
||||||
largest_zins = num_zins;
|
largest_zins = num_zins;
|
||||||
largest_zins_txid = tx.GetHash().ToString();
|
|
||||||
}
|
}
|
||||||
if (num_zouts > largest_zouts) {
|
if (num_zouts > largest_zouts) {
|
||||||
largest_zouts = num_zouts;
|
largest_zouts = num_zouts;
|
||||||
largest_zouts_txid = tx.GetHash().ToString();
|
|
||||||
}
|
|
||||||
if (num_zins >= 10) {
|
|
||||||
total_ztxs_10_or_more_zins++;
|
|
||||||
if (num_zins >= 25) {
|
|
||||||
total_ztxs_25_or_more_zins++;
|
|
||||||
if (num_zins >= 50) {
|
|
||||||
total_ztxs_50_or_more_zins++;
|
|
||||||
if (num_zins >= 100) {
|
|
||||||
total_ztxs_100_or_more_zins++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (num_zouts >= 10) {
|
|
||||||
total_ztxs_10_or_more_zouts++;
|
|
||||||
if (num_zouts >= 25) {
|
|
||||||
total_ztxs_25_or_more_zouts++;
|
|
||||||
if (num_zouts >= 50) {
|
|
||||||
total_ztxs_50_or_more_zouts++;
|
|
||||||
if (num_zouts >= 100) {
|
|
||||||
total_ztxs_100_or_more_zouts++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3834,20 +3774,10 @@ UniValue z_getstats(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
|||||||
ret.pushKV("total_ztxs", total_ztxs);
|
ret.pushKV("total_ztxs", total_ztxs);
|
||||||
ret.pushKV("total_zins", total_zins);
|
ret.pushKV("total_zins", total_zins);
|
||||||
ret.pushKV("total_zouts", total_zouts);
|
ret.pushKV("total_zouts", total_zouts);
|
||||||
ret.pushKV("total_ztxs_10_or_more_zins", total_ztxs_10_or_more_zins);
|
|
||||||
ret.pushKV("total_ztxs_25_or_more_zins", total_ztxs_25_or_more_zins);
|
|
||||||
ret.pushKV("total_ztxs_50_or_more_zins", total_ztxs_50_or_more_zins);
|
|
||||||
ret.pushKV("total_ztxs_100_or_more_zins", total_ztxs_100_or_more_zins);
|
|
||||||
ret.pushKV("total_ztxs_10_or_more_zouts", total_ztxs_10_or_more_zouts);
|
|
||||||
ret.pushKV("total_ztxs_25_or_more_zouts", total_ztxs_25_or_more_zouts);
|
|
||||||
ret.pushKV("total_ztxs_50_or_more_zouts", total_ztxs_50_or_more_zouts);
|
|
||||||
ret.pushKV("total_ztxs_100_or_more_zouts", total_ztxs_100_or_more_zouts);
|
|
||||||
ret.pushKV("avg_zins", avg_zins);
|
ret.pushKV("avg_zins", avg_zins);
|
||||||
ret.pushKV("avg_zouts", avg_zouts);
|
ret.pushKV("avg_zouts", avg_zouts);
|
||||||
ret.pushKV("largest_zins", largest_zins);
|
ret.pushKV("largest_zins", largest_zins);
|
||||||
ret.pushKV("largest_zins_txid", largest_zins_txid);
|
|
||||||
ret.pushKV("largest_zouts", largest_zouts);
|
ret.pushKV("largest_zouts", largest_zouts);
|
||||||
ret.pushKV("largest_zouts_txid", largest_zouts_txid);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user