File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 4
4
` connections_out ` , that provide the number of inbound and outbound peer
5
5
connections. These new fields are in addition to the existing ` connections `
6
6
field, which returns the total number of peer connections. (#19405 )
7
+
8
+ ## CLI
9
+
10
+ - The ` connections ` field of ` bitcoin-cli -getinfo ` is expanded to return a JSON
11
+ object with ` in ` , ` out ` and ` total ` numbers of peer connections. It previously
12
+ returned a single integer value for the total number of peer connections. (#19405 )
Original file line number Diff line number Diff line change @@ -271,7 +271,13 @@ class GetinfoRequestHandler: public BaseRequestHandler
271
271
result.pushKV (" headers" , batch[ID_BLOCKCHAININFO][" result" ][" headers" ]);
272
272
result.pushKV (" verificationprogress" , batch[ID_BLOCKCHAININFO][" result" ][" verificationprogress" ]);
273
273
result.pushKV (" timeoffset" , batch[ID_NETWORKINFO][" result" ][" timeoffset" ]);
274
- result.pushKV (" connections" , batch[ID_NETWORKINFO][" result" ][" connections" ]);
274
+
275
+ UniValue connections (UniValue::VOBJ);
276
+ connections.pushKV (" in" , batch[ID_NETWORKINFO][" result" ][" connections_in" ]);
277
+ connections.pushKV (" out" , batch[ID_NETWORKINFO][" result" ][" connections_out" ]);
278
+ connections.pushKV (" total" , batch[ID_NETWORKINFO][" result" ][" connections" ]);
279
+ result.pushKV (" connections" , connections);
280
+
275
281
result.pushKV (" proxy" , batch[ID_NETWORKINFO][" result" ][" networks" ][0 ][" proxy" ]);
276
282
result.pushKV (" difficulty" , batch[ID_BLOCKCHAININFO][" result" ][" difficulty" ]);
277
283
result.pushKV (" chain" , UniValue (batch[ID_BLOCKCHAININFO][" result" ][" chain" ]));
Original file line number Diff line number Diff line change @@ -71,7 +71,14 @@ def run_test(self):
71
71
assert_equal (cli_get_info ['blocks' ], blockchain_info ['blocks' ])
72
72
assert_equal (cli_get_info ['headers' ], blockchain_info ['headers' ])
73
73
assert_equal (cli_get_info ['timeoffset' ], network_info ['timeoffset' ])
74
- assert_equal (cli_get_info ['connections' ], network_info ['connections' ])
74
+ assert_equal (
75
+ cli_get_info ['connections' ],
76
+ {
77
+ 'in' : network_info ['connections_in' ],
78
+ 'out' : network_info ['connections_out' ],
79
+ 'total' : network_info ['connections' ]
80
+ }
81
+ )
75
82
assert_equal (cli_get_info ['proxy' ], network_info ['networks' ][0 ]['proxy' ])
76
83
assert_equal (cli_get_info ['difficulty' ], blockchain_info ['difficulty' ])
77
84
assert_equal (cli_get_info ['chain' ], blockchain_info ['chain' ])
You can’t perform that action at this time.
0 commit comments