aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-cli.cpp
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2022-05-20 14:22:07 +0200
committerJon Atack <jon@atack.com>2022-05-20 14:33:12 +0200
commitf0bb7db34ce0c8e62dad7d33c1c6b1f49ca81c5e (patch)
tree5a9d74a3d6645cca5fe2f9744c22bda166d49105 /src/bitcoin-cli.cpp
parent0cd1a2eff9e0020ec1052a931f3863794d1a95d9 (diff)
downloadbitcoin-f0bb7db34ce0c8e62dad7d33c1c6b1f49ca81c5e.tar.xz
Fix frequent -netinfo JSON errors from null getpeerinfo#relaytxes
"error: JSON value is not a boolean as expected" due to fRelayTxes/m_relay_txs being moved in PR 21160 from CNodeStats to CNodeStateStats, which made getpeerinfo#relaytxes an optional field that can return UniValue IsNull().
Diffstat (limited to 'src/bitcoin-cli.cpp')
-rw-r--r--src/bitcoin-cli.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index 88cbab1d11..319c721f50 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -477,7 +477,7 @@ public:
const int8_t network_id{NetworkStringToId(network)};
if (network_id == UNKNOWN_NETWORK) continue;
const bool is_outbound{!peer["inbound"].get_bool()};
- const bool is_block_relay{!peer["relaytxes"].get_bool()};
+ const bool is_block_relay{peer["relaytxes"].isNull() ? false : !peer["relaytxes"].get_bool()};
const std::string conn_type{peer["connection_type"].get_str()};
++m_counts.at(is_outbound).at(network_id); // in/out by network
++m_counts.at(is_outbound).at(NETWORKS.size()); // in/out overall