@@ -51,25 +51,27 @@ def set_test_params(self):
51
51
self .supports_cli = False
52
52
53
53
def run_test (self ):
54
- self . log . info ( ' Get out of IBD for the minfeefilter and getpeerinfo tests' )
54
+ # Get out of IBD for the minfeefilter and getpeerinfo tests.
55
55
self .nodes [0 ].generate (101 )
56
- self . log . info ( ' Connect nodes both way' )
56
+ # Connect nodes both ways.
57
57
connect_nodes (self .nodes [0 ], 1 )
58
58
connect_nodes (self .nodes [1 ], 0 )
59
59
60
- self ._test_connection_count ()
61
- self ._test_getpeerinfo ()
62
- self ._test_getnettotals ()
63
- self ._test_getnetworkinfo ()
64
- self ._test_getaddednodeinfo ()
60
+ self .test_connection_count ()
61
+ self .test_getpeerinfo ()
62
+ self .test_getnettotals ()
63
+ self .test_getnetworkinfo ()
64
+ self .test_getaddednodeinfo ()
65
65
self .test_service_flags ()
66
- self ._test_getnodeaddresses ()
66
+ self .test_getnodeaddresses ()
67
67
68
- def _test_connection_count (self ):
69
- # connect_nodes connects each node to the other
68
+ def test_connection_count (self ):
69
+ self .log .info ("Test getconnectioncount" )
70
+ # After using `connect_nodes` to connect nodes 0 and 1 to each other.
70
71
assert_equal (self .nodes [0 ].getconnectioncount (), 2 )
71
72
72
- def _test_getnettotals (self ):
73
+ def test_getnettotals (self ):
74
+ self .log .info ("Test getnettotals" )
73
75
# getnettotals totalbytesrecv and totalbytessent should be
74
76
# consistent with getpeerinfo. Since the RPC calls are not atomic,
75
77
# and messages might have been recvd or sent between RPC calls, call
@@ -99,7 +101,8 @@ def _test_getnettotals(self):
99
101
assert_greater_than_or_equal (after ['bytesrecv_per_msg' ].get ('pong' , 0 ), before ['bytesrecv_per_msg' ].get ('pong' , 0 ) + 32 )
100
102
assert_greater_than_or_equal (after ['bytessent_per_msg' ].get ('ping' , 0 ), before ['bytessent_per_msg' ].get ('ping' , 0 ) + 32 )
101
103
102
- def _test_getnetworkinfo (self ):
104
+ def test_getnetworkinfo (self ):
105
+ self .log .info ("Test getnetworkinfo" )
103
106
assert_equal (self .nodes [0 ].getnetworkinfo ()['networkactive' ], True )
104
107
assert_equal (self .nodes [0 ].getnetworkinfo ()['connections' ], 2 )
105
108
@@ -111,7 +114,7 @@ def _test_getnetworkinfo(self):
111
114
112
115
with self .nodes [0 ].assert_debug_log (expected_msgs = ['SetNetworkActive: true\n ' ]):
113
116
self .nodes [0 ].setnetworkactive (state = True )
114
- self . log . info ( ' Connect nodes both way' )
117
+ # Connect nodes both ways.
115
118
connect_nodes (self .nodes [0 ], 1 )
116
119
connect_nodes (self .nodes [1 ], 0 )
117
120
@@ -123,7 +126,8 @@ def _test_getnetworkinfo(self):
123
126
for info in network_info :
124
127
assert_net_servicesnames (int (info ["localservices" ], 0x10 ), info ["localservicesnames" ])
125
128
126
- def _test_getaddednodeinfo (self ):
129
+ def test_getaddednodeinfo (self ):
130
+ self .log .info ("Test getaddednodeinfo" )
127
131
assert_equal (self .nodes [0 ].getaddednodeinfo (), [])
128
132
# add a node (node2) to node0
129
133
ip_port = "127.0.0.1:{}" .format (p2p_port (2 ))
@@ -142,7 +146,8 @@ def _test_getaddednodeinfo(self):
142
146
# check that a non-existent node returns an error
143
147
assert_raises_rpc_error (- 24 , "Node has not been added" , self .nodes [0 ].getaddednodeinfo , '1.1.1.1' )
144
148
145
- def _test_getpeerinfo (self ):
149
+ def test_getpeerinfo (self ):
150
+ self .log .info ("Test getpeerinfo" )
146
151
# Create a few getpeerinfo last_block/last_transaction values.
147
152
if self .is_wallet_compiled ():
148
153
self .nodes [0 ].sendtoaddress (self .nodes [1 ].getnewaddress (), 1 )
@@ -166,11 +171,13 @@ def _test_getpeerinfo(self):
166
171
assert_net_servicesnames (int (info [0 ]["services" ], 0x10 ), info [0 ]["servicesnames" ])
167
172
168
173
def test_service_flags (self ):
174
+ self .log .info ("Test service flags" )
169
175
self .nodes [0 ].add_p2p_connection (P2PInterface (), services = (1 << 4 ) | (1 << 63 ))
170
176
assert_equal (['UNKNOWN[2^4]' , 'UNKNOWN[2^63]' ], self .nodes [0 ].getpeerinfo ()[- 1 ]['servicesnames' ])
171
177
self .nodes [0 ].disconnect_p2ps ()
172
178
173
- def _test_getnodeaddresses (self ):
179
+ def test_getnodeaddresses (self ):
180
+ self .log .info ("Test getnodeaddresses" )
174
181
self .nodes [0 ].add_p2p_connection (P2PInterface ())
175
182
176
183
# Add some addresses to the Address Manager over RPC. Due to the way
0 commit comments