Skip to content

Commit faf2a67

Browse files
author
MarcoFalke
committed
rpc: Reorder getchaintxstats output
1 parent fa2dada commit faf2a67

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/rpc/blockchain.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,10 +1651,10 @@ static RPCHelpMan getchaintxstats()
16511651
{RPCResult::Type::STR_HEX, "window_final_block_hash", "The hash of the final block in the window"},
16521652
{RPCResult::Type::NUM, "window_final_block_height", "The height of the final block in the window."},
16531653
{RPCResult::Type::NUM, "window_block_count", "Size of the window in number of blocks"},
1654+
{RPCResult::Type::NUM, "window_interval", /*optional=*/true, "The elapsed time in the window in seconds. Only returned if \"window_block_count\" is > 0"},
16541655
{RPCResult::Type::NUM, "window_tx_count", /*optional=*/true,
16551656
"The number of transactions in the window. "
16561657
"Only returned if \"window_block_count\" is > 0 and if txcount exists for the start and end of the window."},
1657-
{RPCResult::Type::NUM, "window_interval", /*optional=*/true, "The elapsed time in the window in seconds. Only returned if \"window_block_count\" is > 0"},
16581658
{RPCResult::Type::NUM, "txrate", /*optional=*/true,
16591659
"The average rate of transactions per second in the window. "
16601660
"Only returned if \"window_interval\" is > 0 and if window_tx_count exists."},
@@ -1711,12 +1711,12 @@ static RPCHelpMan getchaintxstats()
17111711
ret.pushKV("window_final_block_height", pindex->nHeight);
17121712
ret.pushKV("window_block_count", blockcount);
17131713
if (blockcount > 0) {
1714+
ret.pushKV("window_interval", nTimeDiff);
17141715
if (window_tx_count) {
17151716
ret.pushKV("window_tx_count", *window_tx_count);
1716-
}
1717-
ret.pushKV("window_interval", nTimeDiff);
1718-
if (nTimeDiff > 0 && window_tx_count) {
1719-
ret.pushKV("txrate", double(*window_tx_count) / nTimeDiff);
1717+
if (nTimeDiff > 0) {
1718+
ret.pushKV("txrate", double(*window_tx_count) / nTimeDiff);
1719+
}
17201720
}
17211721
}
17221722

0 commit comments

Comments
 (0)