File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 15
15
assert_raises_rpc_error ,
16
16
connect_nodes_bi ,
17
17
p2p_port ,
18
+ wait_until ,
18
19
)
19
20
20
21
class NetTest (BitcoinTestFramework ):
@@ -47,14 +48,13 @@ def _test_getnettotals(self):
47
48
# the bytes sent/received should change
48
49
# note ping and pong are 32 bytes each
49
50
self .nodes [0 ].ping ()
50
- time .sleep (0.1 )
51
+ wait_until (lambda : (net_totals ['totalbytessent' ] + 32 * 2 ) == self .nodes [0 ].getnettotals ()['totalbytessent' ], timeout = 1 )
52
+ wait_until (lambda : (net_totals ['totalbytesrecv' ] + 32 * 2 ) == self .nodes [0 ].getnettotals ()['totalbytesrecv' ], timeout = 1 )
53
+
51
54
peer_info_after_ping = self .nodes [0 ].getpeerinfo ()
52
- net_totals_after_ping = self .nodes [0 ].getnettotals ()
53
55
for before , after in zip (peer_info , peer_info_after_ping ):
54
56
assert_equal (before ['bytesrecv_per_msg' ]['pong' ] + 32 , after ['bytesrecv_per_msg' ]['pong' ])
55
57
assert_equal (before ['bytessent_per_msg' ]['ping' ] + 32 , after ['bytessent_per_msg' ]['ping' ])
56
- assert_equal (net_totals ['totalbytesrecv' ] + 32 * 2 , net_totals_after_ping ['totalbytesrecv' ])
57
- assert_equal (net_totals ['totalbytessent' ] + 32 * 2 , net_totals_after_ping ['totalbytessent' ])
58
58
59
59
def _test_getnetworkinginfo (self ):
60
60
assert_equal (self .nodes [0 ].getnetworkinfo ()['networkactive' ], True )
You can’t perform that action at this time.
0 commit comments