Skip to content

Commit

Permalink
rpc: Reorder getchaintxstats output
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Apr 27, 2024
1 parent fab6856 commit fa73710
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/rpc/blockchain.cpp
Expand Up @@ -1639,10 +1639,10 @@ static RPCHelpMan getchaintxstats()
{RPCResult::Type::STR_HEX, "window_final_block_hash", "The hash of the final block in the window"},
{RPCResult::Type::NUM, "window_final_block_height", "The height of the final block in the window."},
{RPCResult::Type::NUM, "window_block_count", "Size of the window in number of blocks"},
{RPCResult::Type::NUM, "window_interval", /*optional=*/true, "The elapsed time in the window in seconds. Only returned if \"window_block_count\" is > 0"},
{RPCResult::Type::NUM, "window_tx_count", /*optional=*/true,
"The number of transactions in the window. "
"Only returned if \"window_block_count\" is > 0 and if txcount exists for the start end end of the window."},
{RPCResult::Type::NUM, "window_interval", /*optional=*/true, "The elapsed time in the window in seconds. Only returned if \"window_block_count\" is > 0"},
{RPCResult::Type::NUM, "txrate", /*optional=*/true,
"The average rate of transactions per second in the window. "
"Only returned if \"window_interval\" is > 0 and if window_tx_count exists."},
Expand Down Expand Up @@ -1699,12 +1699,12 @@ static RPCHelpMan getchaintxstats()
ret.pushKV("window_final_block_height", pindex->nHeight);
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);
}
ret.pushKV("window_interval", nTimeDiff);
if (nTimeDiff > 0 && window_tx_count) {
ret.pushKV("txrate", double(*window_tx_count) / nTimeDiff);
if (nTimeDiff > 0) {
ret.pushKV("txrate", double(*window_tx_count) / nTimeDiff);
}
}
}

Expand Down

0 comments on commit fa73710

Please sign in to comment.