aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-04-26 17:59:05 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-07-02 08:46:06 +0200
commitfaf2a6750b2da97a18c48a3acf9c9da2aebe86d0 (patch)
tree70c39674f4e583350645c3ce4c45a6d4814db269
parentfa2dada0c9ab61266bcca86fcd28ced873976916 (diff)
downloadbitcoin-faf2a6750b2da97a18c48a3acf9c9da2aebe86d0.tar.xz
rpc: Reorder getchaintxstats output
-rw-r--r--src/rpc/blockchain.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 9db5d58cd3..d0065cb1a6 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1651,10 +1651,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 and 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."},
@@ -1711,12 +1711,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);
+ }
}
}