Add total payment stats to getchaintxstats
This commit is contained in:
@@ -1993,6 +1993,7 @@ UniValue getchaintxstats(const UniValue& params, bool fHelp)
|
|||||||
const CBlockIndex* pindexPast = pindex->GetAncestor(pindex->GetHeight() - blockcount);
|
const CBlockIndex* pindexPast = pindex->GetAncestor(pindex->GetHeight() - blockcount);
|
||||||
int nTimeDiff = pindex->GetMedianTimePast() - pindexPast->GetMedianTimePast();
|
int nTimeDiff = pindex->GetMedianTimePast() - pindexPast->GetMedianTimePast();
|
||||||
int nTxDiff = pindex->nChainTx - pindexPast->nChainTx;
|
int nTxDiff = pindex->nChainTx - pindexPast->nChainTx;
|
||||||
|
int64_t nPaymentsDiff = pindex->nChainPayments - pindexPast->nChainPayments;
|
||||||
|
|
||||||
UniValue ret(UniValue::VOBJ);
|
UniValue ret(UniValue::VOBJ);
|
||||||
ret.pushKV("time", (int64_t)pindex->nTime);
|
ret.pushKV("time", (int64_t)pindex->nTime);
|
||||||
@@ -2004,6 +2005,7 @@ UniValue getchaintxstats(const UniValue& params, bool fHelp)
|
|||||||
ret.pushKV("window_interval", nTimeDiff);
|
ret.pushKV("window_interval", nTimeDiff);
|
||||||
if (nTimeDiff > 0) {
|
if (nTimeDiff > 0) {
|
||||||
ret.pushKV("txrate", ((double)nTxDiff) / nTimeDiff);
|
ret.pushKV("txrate", ((double)nTxDiff) / nTimeDiff);
|
||||||
|
ret.pushKV("paymentrate", ((double)nPaymentsDiff) / nTimeDiff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user