options: set DNS port to network default if not specified

- set port for a DNS announcement without port to network default
- remove x-fail

Changelog-Fixed: Port of a DNS announcement can be 0 if unspecified
This commit is contained in:
Michael Schmoock 2022-07-17 13:36:04 +02:00
parent 6d4285d7c4
commit 65433de05f
2 changed files with 4 additions and 2 deletions

View file

@ -272,7 +272,10 @@ static char *opt_add_addr_withtype(const char *arg,
wi.u.wireaddr.addrlen = strlen(address);
strncpy((char * restrict)&wi.u.wireaddr.addr,
address, sizeof(wi.u.wireaddr.addr) - 1);
wi.u.wireaddr.port = port;
if (port == 0)
wi.u.wireaddr.port = ld->portnum;
else
wi.u.wireaddr.port = port;
tal_arr_expand(&ld->proposed_listen_announce, ADDR_ANNOUNCE);
tal_arr_expand(&ld->proposed_wireaddr, wi);

View file

@ -247,7 +247,6 @@ def test_only_announce_one_dns(node_factory, bitcoind):
@unittest.skipIf(not EXPERIMENTAL_FEATURES, "BOLT7 DNS RFC #911")
@pytest.mark.xfail(strict=True, raises=AssertionError)
def test_announce_dns_without_port(node_factory, bitcoind):
""" Checks that the port of a DNS announcement is set to the corresponding
network port. In this case regtest 19846