mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
test: Fix rpc_net.py "pong" race condition
Prior to this change, the test fails with KeyError if pong has a zero value at the time this is called, as getpeerinfo's bytesrecv_per_msg result excludes zero-values. https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/21310881#L62
This commit is contained in:
parent
f5a70d1462
commit
de23739b22
@ -67,8 +67,8 @@ class NetTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
peer_info_after_ping = self.nodes[0].getpeerinfo()
|
peer_info_after_ping = self.nodes[0].getpeerinfo()
|
||||||
for before, after in zip(peer_info, peer_info_after_ping):
|
for before, after in zip(peer_info, peer_info_after_ping):
|
||||||
assert_greater_than_or_equal(after['bytesrecv_per_msg']['pong'], before['bytesrecv_per_msg']['pong'] + 32)
|
assert_greater_than_or_equal(after['bytesrecv_per_msg'].get('pong', 0), before['bytesrecv_per_msg'].get('pong', 0) + 32)
|
||||||
assert_greater_than_or_equal(after['bytessent_per_msg']['ping'], before['bytessent_per_msg']['ping'] + 32)
|
assert_greater_than_or_equal(after['bytessent_per_msg'].get('ping', 0), before['bytessent_per_msg'].get('ping', 0) + 32)
|
||||||
|
|
||||||
def _test_getnetworkinginfo(self):
|
def _test_getnetworkinginfo(self):
|
||||||
assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], True)
|
assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], True)
|
||||||
|
Loading…
Reference in New Issue
Block a user