Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc_p2p_compactproofs.py
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | def test_send_outbound_getavaproofs(self): | ||||
connection_type="avalanche", | connection_type="avalanche", | ||||
services=NODE_NETWORK | NODE_AVALANCHE, | services=NODE_NETWORK | NODE_AVALANCHE, | ||||
) | ) | ||||
outbound_avapeers.append(peer) | outbound_avapeers.append(peer) | ||||
self.wait_until( | self.wait_until( | ||||
lambda: all([p.last_message.get("getavaproofs") for p in outbound_avapeers])) | lambda: all([p.last_message.get("getavaproofs") for p in outbound_avapeers])) | ||||
assert all([p.message_count.get( | assert all([p.message_count.get( | ||||
"getavaproofs", 0) == 1 for p in outbound_avapeers]) | "getavaproofs", 0) >= 1 for p in outbound_avapeers]) | ||||
assert all([p.message_count.get( | |||||
"getavaproofs", 0) == 0 for p in non_avapeers]) | |||||
assert all([p.message_count.get( | |||||
"getavaproofs", 0) == 0 for p in inbound_avapeers]) | |||||
self.log.info( | |||||
"Check we send periodic getavaproofs message to one of our peers") | |||||
def count_outbounds_getavaproofs(): | |||||
return sum([p.message_count.get("getavaproofs", 0) | |||||
for p in outbound_avapeers]) | |||||
outbounds_getavaproofs = count_outbounds_getavaproofs() | |||||
for i in range(12): | |||||
node.mockscheduler(AVALANCHE_MAX_PERIODIC_NETWORKING_INTERVAL) | |||||
self.wait_until(lambda: count_outbounds_getavaproofs() | |||||
== outbounds_getavaproofs + 1) | |||||
outbounds_getavaproofs += 1 | |||||
assert all([p.message_count.get( | assert all([p.message_count.get( | ||||
"getavaproofs", 0) == 0 for p in non_avapeers]) | "getavaproofs", 0) == 0 for p in non_avapeers]) | ||||
assert all([p.message_count.get( | assert all([p.message_count.get( | ||||
"getavaproofs", 0) == 0 for p in inbound_avapeers]) | "getavaproofs", 0) == 0 for p in inbound_avapeers]) | ||||
def test_send_manual_getavaproofs(self): | def test_send_manual_getavaproofs(self): | ||||
self.log.info( | self.log.info( | ||||
"Check we send a getavaproofs message to our manually connected peers that support avalanche") | "Check we send a getavaproofs message to our manually connected peers that support avalanche") | ||||
▲ Show 20 Lines • Show All 375 Lines • Show Last 20 Lines |