diff --git a/bitcoin/chainparams.c b/bitcoin/chainparams.c index 2f61badbad33..00c7fc29fde6 100644 --- a/bitcoin/chainparams.c +++ b/bitcoin/chainparams.c @@ -63,7 +63,7 @@ const struct chainparams networks[] = { 0x5b, 0xbf, 0x28, 0xc3, 0x4f, 0x3a, 0x5e, 0x33, 0x2a, 0x1f, 0xc7, 0xb2, 0xb7, 0x3c, 0xf1, 0x88, 0x91, 0x0f}}}}, - .rpc_port = 18332, + .rpc_port = 18443, .cli = "bitcoin-cli", .cli_args = "-regtest", .cli_min_supported_version = 150000, diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 3df71745c438..9fb8bb117e6e 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -197,7 +197,6 @@ static struct lightningd *new_lightningd(const tal_t *ctx) * NULL. So we start with a zero-length array. */ ld->proposed_wireaddr = tal_arr(ld, struct wireaddr_internal, 0); ld->proposed_listen_announce = tal_arr(ld, enum addr_listen_announce, 0); - ld->portnum = DEFAULT_PORT; ld->listen = true; ld->autolisten = true; ld->reconnect = true; @@ -952,6 +951,10 @@ int main(int argc, char *argv[]) * non-early opts. This also forks if they say --daemon. */ handle_early_opts(ld, argc, argv); + /*~ Set the default portnum according to the used network + * similarly to what Bitcoin Core does to ports by default. */ + ld->portnum = DEFAULT_PORT + chainparams->rpc_port - 8332; + /*~ Initialize all the plugins we just registered, so they can * do their thing and tell us about themselves (including * options registration). */ diff --git a/tests/test_gossip.py b/tests/test_gossip.py index 30c82cb6f8d7..c8c40d7d5efd 100644 --- a/tests/test_gossip.py +++ b/tests/test_gossip.py @@ -139,8 +139,8 @@ def test_announce_address(node_factory, bitcoind): l1.daemon.wait_for_log(r"\[OUT\] 0101.*47" "010102030404d2" "017f000001...." - "02000000000000000000000000000000002607" - "04e00533f3e8f2aedaa8969b3d0fa03a96e857bbb28064dca5e147e934244b9ba50230032607") + "0200000000000000000000000000000000...." + "04e00533f3e8f2aedaa8969b3d0fa03a96e857bbb28064dca5e147e934244b9ba5023003....") return # We should see it send node announce with all addresses (257 = 0x0101) @@ -154,8 +154,8 @@ def test_announce_address(node_factory, bitcoind): l1.daemon.wait_for_log(r"\[OUT\] 0101.*0063" "010102030404d2" # IPv4 01 1.2.3.4:1234 "017f000001...." # IPv4 01 127.0.0.1:wxyz - "02000000000000000000000000000000002607" # IPv6 02 :::9735 - "04e00533f3e8f2aedaa8969b3d0fa03a96e857bbb28064dca5e147e934244b9ba50230032607" # TORv3 04 + "0200000000000000000000000000000000...." # IPv6 02 ::: + "04e00533f3e8f2aedaa8969b3d0fa03a96e857bbb28064dca5e147e934244b9ba5023003...." # TORv3 04 "05096c6f63616c686f737404d3" # DNS 05 len localhost:1235 "050b6578616d706c652e636f6d04d4") # DNS 05 len example.com:1236 @@ -1018,10 +1018,7 @@ def test_gossip_addresses(node_factory, bitcoind): l1 = node_factory.get_node(options={ 'announce-addr': [ '[::]:3', - '[::]', '127.0.0.1:2', - '127.0.0.1', - 'vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd.onion', '4acth47i6kxnvkewtm6q7ib2s3ufpo5sqbsnzjpbi7utijcltosqemad.onion:1234' ], }) @@ -1036,10 +1033,7 @@ def test_gossip_addresses(node_factory, bitcoind): nodes = l2.rpc.listnodes(l1.info['id'])['nodes'] assert len(nodes) == 1 and nodes[0]['addresses'] == [ {'type': 'ipv4', 'address': '127.0.0.1', 'port': 2}, - {'type': 'ipv4', 'address': '127.0.0.1', 'port': 9735}, {'type': 'ipv6', 'address': '::', 'port': 3}, - {'type': 'ipv6', 'address': '::', 'port': 9735}, - {'type': 'torv3', 'address': 'vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd.onion', 'port': 9735}, {'type': 'torv3', 'address': '4acth47i6kxnvkewtm6q7ib2s3ufpo5sqbsnzjpbi7utijcltosqemad.onion', 'port': 1234}, ] @@ -1911,7 +1905,7 @@ def test_statictor_onions(node_factory): }) assert l1.daemon.is_in_log('127.0.0.1:{}'.format(l1.port)) - assert l2.daemon.is_in_log('x2y4zvh4fn5q3eouuh7nxnc7zeawrqoutljrup2xjtiyxgx3emgkemad.onion:9735,127.0.0.1:{}'.format(l2.port)) + assert l2.daemon.is_in_log('x2y4zvh4fn5q3eouuh7nxnc7zeawrqoutljrup2xjtiyxgx3emgkemad.onion:{},127.0.0.1:{}'.format(l2.port, l2.port)) @pytest.mark.developer("needs a running Tor service instance at port 9151 or 9051")