diff --git a/connectd/peer_exchange_initmsg.c b/connectd/peer_exchange_initmsg.c index 551de9767..8223bd751 100644 --- a/connectd/peer_exchange_initmsg.c +++ b/connectd/peer_exchange_initmsg.c @@ -100,7 +100,12 @@ static struct io_plan *peer_init_received(struct io_conn *conn, switch (tlvs->remote_addr->type) { case ADDR_TYPE_IPV4: case ADDR_TYPE_IPV6: - remote_addr = tal_steal(peer, tlvs->remote_addr); +#if DEVELOPER /* ignore private addresses (non-DEVELOPER builds) */ + if (address_routable(tlvs->remote_addr, true)) +#else + if (address_routable(tlvs->remote_addr, false)) +#endif /* DEVELOPER */ + remote_addr = tal_steal(peer, tlvs->remote_addr); break; /* We are only interested in IP addresses */ case ADDR_TYPE_TOR_V2_REMOVED: diff --git a/tests/test_connection.py b/tests/test_connection.py index 5e4cfbe15..68572770c 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -10,7 +10,7 @@ from utils import ( expected_channel_features, check_coin_moves, first_channel_id, account_balance, basic_fee, scriptpubkey_addr, - EXPERIMENTAL_FEATURES, mine_funding_to_announce + DEVELOPER, EXPERIMENTAL_FEATURES, mine_funding_to_announce ) from pyln.testing.utils import SLOW_MACHINE, VALGRIND, EXPERIMENTAL_DUAL_FUND, FUNDAMOUNT @@ -23,7 +23,7 @@ import unittest import websocket -def test_connect(node_factory): +def test_connect_basic(node_factory): l1, l2 = node_factory.line_graph(2, fundchannel=False) # These should be in openingd. @@ -46,8 +46,9 @@ def test_connect(node_factory): assert len(l1.rpc.listpeers()) == 1 assert len(l2.rpc.listpeers()) == 1 - if EXPERIMENTAL_FEATURES: - l1.daemon.wait_for_log("Peer says it sees our address as: 127.0.0.1:[0-9]{5}") + if EXPERIMENTAL_FEATURES: # BOLT1 remote_addr #917 + if DEVELOPER: + print(l1.daemon.wait_for_log("Peer says it sees our address as: 127.0.0.1:[0-9]{5}")) # Should get reasonable error if unknown addr for peer. with pytest.raises(RpcError, match=r'Unable to connect, no address known'): diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 73452636a..979d8c41a 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -452,6 +452,7 @@ def test_plugin_connected_hook_chaining(node_factory): @unittest.skipIf(not EXPERIMENTAL_FEATURES, "BOLT1 remote_addr #917") +@pytest.mark.developer("localhost remote_addr will be filtered without DEVELOEPR") def test_peer_connected_remote_addr(node_factory): """This tests the optional tlv `remote_addr` being passed to a plugin.