MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_remote_addr_disabled

Function test_remote_addr_disabled

tests/test_connection.py:157–193  ·  view source on GitHub ↗

Simply tests that IP address discovery announcements can be turned off We perform logic tests on L2, setup: l1 --> [l2] <-- l3

(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

155
156
157def test_remote_addr_disabled(node_factory, bitcoind):
158 """Simply tests that IP address discovery announcements can be turned off
159
160 We perform logic tests on L2, setup:
161 l1 --> [l2] <-- l3
162 """
163 opts = {'dev-allow-localhost': None,
164 'announce-addr-discovered': False,
165 'may_reconnect': True,
166 'dev-no-reconnect': None}
167 l1, l2, l3 = node_factory.get_nodes(3, opts=[opts, opts, opts])
168
169 # l1->l2
170 l2.rpc.connect(l1.info['id'], 'localhost', l1.port)
171 l2.daemon.wait_for_log("Peer says it sees our address as: 127.0.0.1:[0-9]{5}")
172 l1.fundchannel(l2)
173 bitcoind.generate_block(6)
174 l1.daemon.wait_for_log(f"Received node_announcement for node {l2.info['id']}")
175 # l2->l3
176 l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
177 l2.daemon.wait_for_log("Peer says it sees our address as: 127.0.0.1:[0-9]{5}")
178 l2.fundchannel(l3)
179 bitcoind.generate_block(6)
180 l3.daemon.wait_for_log(f"Received node_announcement for node {l2.info['id']}")
181
182 # restart both and wait for channels to be ready
183 l1.restart()
184 l2.rpc.connect(l1.info['id'], 'localhost', l1.port)
185 l2.daemon.wait_for_log(f"{l1.info['id']}.*Already have funding locked in")
186 l3.restart()
187 l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
188 l2.daemon.wait_for_log(f"{l3.info['id']}.*Already have funding locked in")
189
190 # if ip discovery would have been enabled, we would have send an updated
191 # node_announcement by now. Check we didn't...
192 bitcoind.generate_block(6) # ugly, but we need to wait for gossip...
193 assert not l2.daemon.is_in_log("Update our node_announcement for discovered address")
194
195
196def test_remote_addr_port(node_factory, bitcoind):

Callers

nothing calls this directly

Calls 7

get_nodesMethod · 0.80
wait_for_logMethod · 0.80
generate_blockMethod · 0.80
restartMethod · 0.80
is_in_logMethod · 0.80
connectMethod · 0.45
fundchannelMethod · 0.45

Tested by

no test coverage detected