Skip to content

Commit 7d2cc5c

Browse files
committed
lightningd: deprecated experimental-websocket-port now we can use bind=ws:
Changelog-Deprecated: `experimental-websocket-port`: use `--bind=ws::<portnum>`. Signed-off-by: Rusty Russell <[email protected]>
1 parent f52c40c commit 7d2cc5c

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

lightningd/options.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,9 @@ static char *opt_set_websocket_port(const char *arg, struct lightningd *ld)
10811081
u32 port COMPILER_WANTS_INIT("9.3.0 -O2");
10821082
char *err;
10831083

1084+
if (!deprecated_apis)
1085+
return "--experimental-websocket-port been deprecated, use --bind=ws:...";
1086+
10841087
err = opt_set_u32(arg, &port);
10851088
if (err)
10861089
return err;
@@ -1364,9 +1367,7 @@ static void register_opts(struct lightningd *ld)
13641367

13651368
opt_register_arg("--experimental-websocket-port",
13661369
opt_set_websocket_port, NULL,
1367-
ld,
1368-
"experimental: alternate port for peers to connect"
1369-
" using WebSockets (RFC6455)");
1370+
ld, opt_hidden);
13701371
opt_register_noarg("--experimental-upgrade-protocol",
13711372
opt_set_bool, &ld->experimental_upgrade_protocol,
13721373
"experimental: allow channel types to be upgraded on reconnect");

tests/test_connection.py

+14-7
Original file line numberDiff line numberDiff line change
@@ -4058,17 +4058,24 @@ def test_old_feerate(node_factory):
40584058
@pytest.mark.developer("needs --dev-allow-localhost")
40594059
def test_websocket(node_factory):
40604060
ws_port = reserve()
4061-
port1, port2 = reserve(), reserve()
4062-
# We need a wildcard to show the websocket bug, but we need a real
4063-
# address to give us something to announce.
4061+
port = reserve()
40644062
l1, l2 = node_factory.line_graph(2,
4065-
opts=[{'experimental-websocket-port': ws_port,
4066-
'addr': [':' + str(port1),
4067-
'127.0.0.1: ' + str(port2)],
4063+
opts=[{'addr': ':' + str(port),
4064+
'bind-addr': 'ws:127.0.0.1: ' + str(ws_port),
40684065
'dev-allow-localhost': None},
40694066
{'dev-allow-localhost': None}],
40704067
wait_for_announce=True)
4071-
assert l1.rpc.listconfigs()['experimental-websocket-port'] == ws_port
4068+
# Some depend on ipv4 vs ipv6 behaviour...
4069+
for b in l1.rpc.getinfo()['binding']:
4070+
if b['type'] == 'ipv4':
4071+
assert b == {'type': 'ipv4', 'address': '0.0.0.0', 'port': port}
4072+
elif b['type'] == 'ipv6':
4073+
assert b == {'type': 'ipv6', 'address': '::', 'port': port}
4074+
else:
4075+
assert b == {'type': 'websocket',
4076+
'address': '127.0.0.1',
4077+
'subtype': 'ipv4',
4078+
'port': ws_port}
40724079

40734080
# Adapter to turn websocket into a stream "connection"
40744081
class BinWebSocket(object):

0 commit comments

Comments
 (0)