Skip to content

Commit ef2f149

Browse files
committed
[test] Update GetAddrStore callers to use AddrReceiver
1 parent e8c67ea commit ef2f149

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/functional/p2p_addr_relay.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def relay_tests(self):
140140

141141
self.log.info('Check relay of addresses received from outbound peers')
142142
inbound_peer = self.nodes[0].add_p2p_connection(AddrReceiver(test_addr_contents=True))
143-
full_outbound_peer = self.nodes[0].add_outbound_p2p_connection(GetAddrStore(), p2p_idx=0, connection_type="outbound-full-relay")
143+
full_outbound_peer = self.nodes[0].add_outbound_p2p_connection(AddrReceiver(), p2p_idx=0, connection_type="outbound-full-relay")
144144
msg = self.setup_addr_msg(2)
145145
self.send_addr_msg(full_outbound_peer, msg, [inbound_peer])
146146
self.log.info('Check that the first addr message received from an outbound peer is not relayed')
@@ -156,7 +156,7 @@ def relay_tests(self):
156156
assert_equal(inbound_peer.num_ipv4_received, 2)
157157

158158
self.log.info('Check address relay to outbound peers')
159-
block_relay_peer = self.nodes[0].add_outbound_p2p_connection(GetAddrStore(), p2p_idx=1, connection_type="block-relay-only")
159+
block_relay_peer = self.nodes[0].add_outbound_p2p_connection(AddrReceiver(), p2p_idx=1, connection_type="block-relay-only")
160160
msg3 = self.setup_addr_msg(2)
161161
self.send_addr_msg(inbound_peer, msg3, [full_outbound_peer, block_relay_peer])
162162

@@ -170,17 +170,17 @@ def relay_tests(self):
170170
def getaddr_tests(self):
171171
self.log.info('Test getaddr behavior')
172172
self.log.info('Check that we send a getaddr message upon connecting to an outbound-full-relay peer')
173-
full_outbound_peer = self.nodes[0].add_outbound_p2p_connection(GetAddrStore(), p2p_idx=0, connection_type="outbound-full-relay")
173+
full_outbound_peer = self.nodes[0].add_outbound_p2p_connection(AddrReceiver(), p2p_idx=0, connection_type="outbound-full-relay")
174174
full_outbound_peer.sync_with_ping()
175-
assert full_outbound_peer.getaddr_received
175+
assert full_outbound_peer.getaddr_received()
176176

177177
self.log.info('Check that we do not send a getaddr message upon connecting to a block-relay-only peer')
178-
block_relay_peer = self.nodes[0].add_outbound_p2p_connection(GetAddrStore(), p2p_idx=1, connection_type="block-relay-only")
178+
block_relay_peer = self.nodes[0].add_outbound_p2p_connection(AddrReceiver(), p2p_idx=1, connection_type="block-relay-only")
179179
block_relay_peer.sync_with_ping()
180-
assert_equal(block_relay_peer.getaddr_received, False)
180+
assert_equal(block_relay_peer.getaddr_received(), False)
181181

182182
self.log.info('Check that we answer getaddr messages only from inbound peers')
183-
inbound_peer = self.nodes[0].add_p2p_connection(GetAddrStore())
183+
inbound_peer = self.nodes[0].add_p2p_connection(AddrReceiver())
184184
inbound_peer.sync_with_ping()
185185

186186
# Add some addresses to addrman
@@ -196,7 +196,7 @@ def getaddr_tests(self):
196196

197197
self.mocktime += 5 * 60
198198
self.nodes[0].setmocktime(self.mocktime)
199-
inbound_peer.wait_until(inbound_peer.addr_received)
199+
inbound_peer.wait_until(lambda: inbound_peer.addr_received() is True)
200200

201201
assert_equal(full_outbound_peer.num_ipv4_received, 0)
202202
assert_equal(block_relay_peer.num_ipv4_received, 0)
@@ -210,9 +210,9 @@ def blocksonly_mode_tests(self):
210210
self.mocktime = int(time.time())
211211

212212
self.log.info('Check that we send getaddr messages')
213-
full_outbound_peer = self.nodes[0].add_outbound_p2p_connection(GetAddrStore(), p2p_idx=0, connection_type="outbound-full-relay")
213+
full_outbound_peer = self.nodes[0].add_outbound_p2p_connection(AddrReceiver(), p2p_idx=0, connection_type="outbound-full-relay")
214214
full_outbound_peer.sync_with_ping()
215-
assert full_outbound_peer.getaddr_received
215+
assert full_outbound_peer.getaddr_received()
216216

217217
self.log.info('Check that we relay address messages')
218218
addr_source = self.nodes[0].add_p2p_connection(P2PInterface())

0 commit comments

Comments
 (0)