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 b2bb0cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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 b2bb0cb

Please sign in to comment.