Skip to content

Commit 92df5d8

Browse files
lightningd: use the standard port derivation in connect command
Complete implementation of BOLT1 port derivation proposal lightning/bolts#968 Changelog-Added: rpc: use the standard port derivation in connect command when the port is not specified. Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent c137a7e commit 92df5d8

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

bitcoin/chainparams.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const struct chainparams networks[] = {
9494
0x2c, 0x42, 0x25, 0xe9, 0x73, 0x98, 0x81,
9595
0x08, 0x00, 0x00, 0x00}}}},
9696
.rpc_port = 38332,
97-
.ln_port = 9735,
97+
.ln_port = 39735,
9898
.cli = "bitcoin-cli",
9999
.cli_args = "-signet",
100100
.cli_min_supported_version = 150000,
@@ -118,7 +118,7 @@ const struct chainparams networks[] = {
118118
0xe9, 0x0e, 0xad, 0x01, 0xea, 0x33, 0x09,
119119
0x00, 0x00, 0x00, 0x00}}}},
120120
.rpc_port = 18332,
121-
.rpc_port = 19735,
121+
.ln_port = 19735,
122122
.cli = "bitcoin-cli",
123123
.cli_args = "-testnet",
124124
.cli_min_supported_version = 150000,

lightningd/connect_control.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "config.h"
2+
#include <bitcoin/chainparams.h>
23
#include <ccan/err/err.h>
34
#include <ccan/tal/str/str.h>
45
#include <common/configdir.h>
@@ -140,7 +141,7 @@ static struct command_result *json_connect(struct command *cmd,
140141
/* Is there a port? */
141142
if (!port) {
142143
port = tal(cmd, u32);
143-
*port = DEFAULT_PORT;
144+
*port = chainparams->ln_port;
144145
}
145146
addr = tal(cmd, struct wireaddr_internal);
146147
if (!parse_wireaddr_internal(name, addr, *port, false,

lightningd/lightningd.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ int main(int argc, char *argv[])
969969

970970
/*~ Set the default portnum according to the used network
971971
* similarly to what Bitcoin Core does to ports by default. */
972-
ld->portnum = DEFAULT_PORT + chainparams->rpc_port - 8332;
972+
ld->portnum = chainparams->ln_port;
973973

974974
/*~ Initialize all the plugins we just registered, so they can
975975
* do their thing and tell us about themselves (including

0 commit comments

Comments
 (0)