mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge 8e1bd17252 into merged_master (Bitcoin PR bitcoin/bitcoin#30544)
This commit is contained in:
commit
dd7fa7702a
1 changed files with 4 additions and 6 deletions
|
|
@ -1929,9 +1929,6 @@ static RPCHelpMan getchaintxstats()
|
|||
|
||||
const CBlockIndex& past_block{*CHECK_NONFATAL(pindex->GetAncestor(pindex->nHeight - blockcount))};
|
||||
const int64_t nTimeDiff{pindex->GetMedianTimePast() - past_block.GetMedianTimePast()};
|
||||
const auto window_tx_count{
|
||||
(pindex->nChainTx != 0 && past_block.nChainTx != 0) ? std::optional{pindex->nChainTx - past_block.nChainTx} : std::nullopt,
|
||||
};
|
||||
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
ret.pushKV("time", (int64_t)pindex->nTime);
|
||||
|
|
@ -1943,10 +1940,11 @@ static RPCHelpMan getchaintxstats()
|
|||
ret.pushKV("window_block_count", blockcount);
|
||||
if (blockcount > 0) {
|
||||
ret.pushKV("window_interval", nTimeDiff);
|
||||
if (window_tx_count) {
|
||||
ret.pushKV("window_tx_count", *window_tx_count);
|
||||
if (pindex->nChainTx != 0 && past_block.nChainTx != 0) {
|
||||
const auto window_tx_count = pindex->nChainTx - past_block.nChainTx;
|
||||
ret.pushKV("window_tx_count", window_tx_count);
|
||||
if (nTimeDiff > 0) {
|
||||
ret.pushKV("txrate", double(*window_tx_count) / nTimeDiff);
|
||||
ret.pushKV("txrate", double(window_tx_count) / nTimeDiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue