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

Function test_remote_addr_disabled

tests/test_connection.py:151–185  ·  view source on GitHub ↗

Simply tests that IP address discovery annoucements 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

149
150@pytest.mark.developer("needs DEVELOPER=1 for fast gossip and --dev-allow-localhost for local remote_addr")
151def test_remote_addr_disabled(node_factory, bitcoind):
152 """Simply tests that IP address discovery annoucements can be turned off
153
154 We perform logic tests on L2, setup:
155 l1 --> [l2] <-- l3
156 """
157 opts = {'dev-allow-localhost': None,
158 'disable-ip-discovery': None,
159 'may_reconnect': True,
160 'dev-no-reconnect': None}
161 l1, l2, l3 = node_factory.get_nodes(3, opts=[opts, opts, opts])
162
163 # l1->l2
164 l2.rpc.connect(l1.info['id'], 'localhost', l1.port)
165 l2.daemon.wait_for_log("Peer says it sees our address as: 127.0.0.1:[0-9]{5}")
166 l1.fundchannel(l2)
167 bitcoind.generate_block(5)
168 l1.daemon.wait_for_log(f"Received node_announcement for node {l2.info['id']}")
169 # l2->l3
170 l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
171 l2.daemon.wait_for_log("Peer says it sees our address as: 127.0.0.1:[0-9]{5}")
172 l2.fundchannel(l3)
173 bitcoind.generate_block(5)
174
175 # restart both and wait for channels to be ready
176 l1.restart()
177 l2.rpc.connect(l1.info['id'], 'localhost', l1.port)
178 l2.daemon.wait_for_log("Already have funding locked in")
179 l3.restart()
180 l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
181 l2.daemon.wait_for_log("Already have funding locked in")
182
183 # if ip discovery would have been enabled, we would have send an updated
184 # node_annoucement by now. Check we didn't...
185 assert not l2.daemon.is_in_log("Update our node_announcement for discovered address")
186
187
188def test_connect_standard_addr(node_factory):

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