Skip to content

Commit f0bb7db

Browse files
committed
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().
1 parent 0cd1a2e commit f0bb7db

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/bitcoin-cli.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
477477
const int8_t network_id{NetworkStringToId(network)};
478478
if (network_id == UNKNOWN_NETWORK) continue;
479479
const bool is_outbound{!peer["inbound"].get_bool()};
480-
const bool is_block_relay{!peer["relaytxes"].get_bool()};
480+
const bool is_block_relay{peer["relaytxes"].isNull() ? false : !peer["relaytxes"].get_bool()};
481481
const std::string conn_type{peer["connection_type"].get_str()};
482482
++m_counts.at(is_outbound).at(network_id); // in/out by network
483483
++m_counts.at(is_outbound).at(NETWORKS.size()); // in/out overall

0 commit comments

Comments
 (0)