Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc_p2p_getavaaddr.py
Show First 20 Lines • Show All 246 Lines • ▼ Show 20 Lines | def getavaaddr_outbound_test(self): | ||||
avapeers.append(avapeer) | avapeers.append(avapeer) | ||||
self.check_all_peers_received_getavaaddr_once(avapeers) | self.check_all_peers_received_getavaaddr_once(avapeers) | ||||
# Generate some block to poll for | # Generate some block to poll for | ||||
node.generate(1) | node.generate(1) | ||||
# Because none of the avalanche peers is responding, our node should | # Because none of the avalanche peers is responding, our node should | ||||
# fail out of option shortly and send a getavaaddr message to one of its | # fail out of option shortly and send a getavaaddr message to 3 of its | ||||
# outbound avalanche peers. | # outbound avalanche peers. | ||||
node.mockscheduler(MAX_GETAVAADDR_DELAY) | node.mockscheduler(MAX_GETAVAADDR_DELAY) | ||||
def any_peer_received_getavaaddr(): | def three_peer_received_getavaaddr(): | ||||
sdulfari: The actual number may change. No reason to tie the function name to the number. | |||||
with p2p_lock: | with p2p_lock: | ||||
return any([p.message_count.get( | return sum([p.message_count.get( | ||||
"getavaaddr", 0) > 1 for p in avapeers]) | "getavaaddr", 0) > 1 for p in avapeers]) == 3 | ||||
self.wait_until(any_peer_received_getavaaddr) | self.wait_until(three_peer_received_getavaaddr) | ||||
def getavaaddr_manual_test(self): | def getavaaddr_manual_test(self): | ||||
self.log.info( | self.log.info( | ||||
"Check we send a getavaaddr message to our manually connected peers that support avalanche") | "Check we send a getavaaddr message to our manually connected peers that support avalanche") | ||||
node = self.nodes[0] | node = self.nodes[0] | ||||
# Get rid of previously connected nodes | # Get rid of previously connected nodes | ||||
node.disconnect_p2ps() | node.disconnect_p2ps() | ||||
▲ Show 20 Lines • Show All 173 Lines • Show Last 20 Lines |
The actual number may change. No reason to tie the function name to the number.