Skip to content

Commit a3ea9fd

Browse files
m-schmoockrustyrussell
authored andcommitted
chore: use EXPERIMENTAL for BOLT7 DNS #911
Changelog-EXPERIMENTAL: Ability to announce DNS addresses
1 parent 2b8896a commit a3ea9fd

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

connectd/connectd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,12 +928,14 @@ static void try_connect_one_addr(struct connecting *connect)
928928
bool use_proxy = connect->daemon->always_use_proxy;
929929
const struct wireaddr_internal *addr = &connect->addrs[connect->addrnum];
930930
struct io_conn *conn;
931+
#if EXPERIMENTAL_FEATURES /* BOLT7 DNS RFC #911 */
931932
bool use_dns = connect->daemon->use_dns;
932933
struct addrinfo hints, *ais, *aii;
933934
struct wireaddr_internal addrhint;
934935
int gai_err;
935936
struct sockaddr_in *sa4;
936937
struct sockaddr_in6 *sa6;
938+
#endif
937939

938940
/* In case we fail without a connection, make destroy_io_conn happy */
939941
connect->conn = NULL;
@@ -984,6 +986,7 @@ static void try_connect_one_addr(struct connecting *connect)
984986
af = AF_INET6;
985987
break;
986988
case ADDR_TYPE_DNS:
989+
#if EXPERIMENTAL_FEATURES /* BOLT7 DNS RFC #911 */
987990
if (use_proxy) /* hand it to the proxy */
988991
break;
989992
if (!use_dns) /* ignore DNS when we can't use it */
@@ -1025,6 +1028,7 @@ static void try_connect_one_addr(struct connecting *connect)
10251028
addr = &connect->addrs[connect->addrnum];
10261029
}
10271030
freeaddrinfo(ais);
1031+
#endif
10281032
goto next;
10291033
case ADDR_TYPE_WEBSOCKET:
10301034
af = -1;
@@ -1666,8 +1670,10 @@ static void add_seed_addrs(struct wireaddr_internal **addrs,
16661670
NULL, broken_reply, NULL);
16671671
if (new_addrs) {
16681672
for (size_t j = 0; j < tal_count(new_addrs); j++) {
1673+
#if EXPERIMENTAL_FEATURES /* BOLT7 DNS RFC #911 */
16691674
if (new_addrs[j].type == ADDR_TYPE_DNS)
16701675
continue;
1676+
#endif
16711677
struct wireaddr_internal a;
16721678
a.itype = ADDR_INTERNAL_WIREADDR;
16731679
a.u.wireaddr = new_addrs[j];

lightningd/options.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ static char *opt_add_addr_withtype(const char *arg,
221221
tal_arr_expand(&ld->proposed_wireaddr, wi);
222222
}
223223

224+
#if EXPERIMENTAL_FEATURES /* BOLT7 DNS RFC #911 */
224225
/* Add ADDR_TYPE_DNS to announce DNS hostnames */
225226
if (is_dnsaddr(address) && ala & ADDR_ANNOUNCE) {
226227
memset(&wi, 0, sizeof(wi));
@@ -234,6 +235,7 @@ static char *opt_add_addr_withtype(const char *arg,
234235
tal_arr_expand(&ld->proposed_listen_announce, ADDR_ANNOUNCE);
235236
tal_arr_expand(&ld->proposed_wireaddr, wi);
236237
}
238+
#endif
237239

238240
return NULL;
239241

tests/test_gossip.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
from fixtures import TEST_NETWORK
55
from pyln.client import RpcError, Millisatoshi
66
from utils import (
7-
DEVELOPER, wait_for, TIMEOUT, only_one, sync_blockheight, expected_node_features, COMPAT
7+
DEVELOPER, wait_for, TIMEOUT, only_one, sync_blockheight,
8+
expected_node_features, COMPAT, EXPERIMENTAL_FEATURES
89
)
910

1011
import json
@@ -118,6 +119,13 @@ def test_announce_address(node_factory, bitcoind):
118119
'::'],
119120
'log-level': 'io',
120121
'dev-allow-localhost': None}
122+
if not EXPERIMENTAL_FEATURES: # BOLT7 DNS RFC #911
123+
opts = {'disable-dns': None, 'announce-addr':
124+
['4acth47i6kxnvkewtm6q7ib2s3ufpo5sqbsnzjpbi7utijcltosqemad.onion',
125+
'1.2.3.4:1234',
126+
'::'],
127+
'log-level': 'io',
128+
'dev-allow-localhost': None}
121129
l1, l2 = node_factory.get_nodes(2, opts=[opts, {}])
122130

123131
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
@@ -127,6 +135,14 @@ def test_announce_address(node_factory, bitcoind):
127135
l1.wait_channel_active(scid)
128136
l2.wait_channel_active(scid)
129137

138+
if not EXPERIMENTAL_FEATURES: # BOLT7 DNS RFC #911
139+
l1.daemon.wait_for_log(r"\[OUT\] 0101.*47"
140+
"010102030404d2"
141+
"017f000001...."
142+
"02000000000000000000000000000000002607"
143+
"04e00533f3e8f2aedaa8969b3d0fa03a96e857bbb28064dca5e147e934244b9ba50230032607")
144+
return
145+
130146
# We should see it send node announce with all addresses (257 = 0x0101)
131147
# Note: local ephemeral port is masked out.
132148
# Note: Since we `disable-dns` it should not announce a resolved IPv4
@@ -154,6 +170,7 @@ def test_announce_address(node_factory, bitcoind):
154170
assert addresses_dns[1]['port'] == 1236
155171

156172

173+
@unittest.skipIf(not EXPERIMENTAL_FEATURES, "BOLT7 DNS RFC #911")
157174
@pytest.mark.developer("gossip without DEVELOPER=1 is slow")
158175
def test_announce_and_connect_via_dns(node_factory, bitcoind):
159176
""" Test that DNS annoucements propagate and can be used when connecting.

0 commit comments

Comments
 (0)