Skip to content

Commit dd953cf

Browse files
committed
lightningd: make option_data_loss_protect compulsory.
As suggested in lightning/bolts#1092. Signed-off-by: Rusty Russell <[email protected]> Changelog-Changed: Protocol: `option_data_loss_protect` is now required (advertized by all but 11 nodes)
1 parent e83c9fe commit dd953cf

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

lightningd/lightningd.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,9 +869,16 @@ static struct io_plan *sigchld_rfd_in(struct io_conn *conn,
869869
* features later, or adding them when supplied by plugins. */
870870
static struct feature_set *default_features(const tal_t *ctx)
871871
{
872+
/* BOLT PR https://github.com/lightning/bolts/pull/1092
873+
* suggests making the following compulsory:
874+
* var_onion_optin (all but 6 nodes)
875+
* gossip_queries (all but 11 nodes)
876+
* option_data_loss_protect (all but 11 nodes)
877+
* option_static_remotekey (all but 16 nodes)
878+
*/
872879
struct feature_set *ret = NULL;
873880
static const u32 features[] = {
874-
OPTIONAL_FEATURE(OPT_DATA_LOSS_PROTECT),
881+
COMPULSORY_FEATURE(OPT_DATA_LOSS_PROTECT),
875882
OPTIONAL_FEATURE(OPT_UPFRONT_SHUTDOWN_SCRIPT),
876883
OPTIONAL_FEATURE(OPT_GOSSIP_QUERIES),
877884
COMPULSORY_FEATURE(OPT_VAR_ONION),

tests/test_connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3577,9 +3577,9 @@ def test_nonstatic_channel(node_factory, bitcoind):
35773577
"""Smoke test for a channel without option_static_remotekey"""
35783578
l1, l2 = node_factory.line_graph(2,
35793579
opts=[{},
3580-
# needs at least 15 to connect
3580+
# needs at least 1 and 15 to connect
35813581
# (and 9 is a dependent)
3582-
{'dev-force-features': '9,15////////'}])
3582+
{'dev-force-features': '1,9,15////////'}])
35833583
chan = only_one(l1.rpc.listpeerchannels()['channels'])
35843584
assert 'option_static_remotekey' not in chan['features']
35853585
assert 'option_anchor' not in chan['features']

tests/test_misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2243,7 +2243,7 @@ def test_dev_demux(node_factory):
22432243
def test_list_features_only(node_factory):
22442244
features = subprocess.check_output(['lightningd/lightningd',
22452245
'--list-features-only']).decode('utf-8').splitlines()
2246-
expected = ['option_data_loss_protect/odd',
2246+
expected = ['option_data_loss_protect/even',
22472247
'option_upfront_shutdown_script/odd',
22482248
'option_gossip_queries/odd',
22492249
'option_var_onion_optin/even',

tests/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def hex_bits(features):
3636

3737
def expected_peer_features(extra=[]):
3838
"""Return the expected peer features hexstring for this configuration"""
39-
features = [1, 5, 7, 8, 11, 13, 14, 17, 19, 25, 27, 45, 47, 51]
39+
features = [0, 5, 7, 8, 11, 13, 14, 17, 19, 25, 27, 45, 47, 51]
4040
if EXPERIMENTAL_DUAL_FUND:
4141
# option_dual_fund
4242
features += [29]
@@ -50,7 +50,7 @@ def expected_peer_features(extra=[]):
5050
# features for the 'node' and the 'peer' feature sets
5151
def expected_node_features(extra=[]):
5252
"""Return the expected node features hexstring for this configuration"""
53-
features = [1, 5, 7, 8, 11, 13, 14, 17, 19, 25, 27, 45, 47, 51, 55]
53+
features = [0, 5, 7, 8, 11, 13, 14, 17, 19, 25, 27, 45, 47, 51, 55]
5454
if EXPERIMENTAL_DUAL_FUND:
5555
# option_dual_fund
5656
features += [29]

0 commit comments

Comments
 (0)