Skip to content

Commit b2bb0cb

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 b2bb0cb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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)