Skip to content

Commit

Permalink
lightningd: use the standard port derivation in connect command
Browse files Browse the repository at this point in the history
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 <vincenzopalazzodev@gmail.com>
  • Loading branch information
vincenzopalazzo committed May 8, 2022
1 parent c137a7e commit c60287b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bitcoin/chainparams.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const struct chainparams networks[] = {
0x2c, 0x42, 0x25, 0xe9, 0x73, 0x98, 0x81,
0x08, 0x00, 0x00, 0x00}}}},
.rpc_port = 38332,
.ln_port = 9735,
.ln_port = 39735,
.cli = "bitcoin-cli",
.cli_args = "-signet",
.cli_min_supported_version = 150000,
Expand Down
3 changes: 2 additions & 1 deletion lightningd/connect_control.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "config.h"
#include <bitcoin/chainparams.h>
#include <ccan/err/err.h>
#include <ccan/tal/str/str.h>
#include <common/configdir.h>
Expand Down Expand Up @@ -140,7 +141,7 @@ static struct command_result *json_connect(struct command *cmd,
/* Is there a port? */
if (!port) {
port = tal(cmd, u32);
*port = DEFAULT_PORT;
*port = chainparams->ln_port;
}
addr = tal(cmd, struct wireaddr_internal);
if (!parse_wireaddr_internal(name, addr, *port, false,
Expand Down
2 changes: 1 addition & 1 deletion lightningd/lightningd.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ int main(int argc, char *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;
ld->portnum = chainparams->ln_port;

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

0 comments on commit c60287b

Please sign in to comment.