Skip to content

Commit

Permalink
lightningd: make option_data_loss_protect compulsory.
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
rustyrussell committed Nov 12, 2023
1 parent e83c9fe commit dd953cf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
9 changes: 8 additions & 1 deletion lightningd/lightningd.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,9 +869,16 @@ static struct io_plan *sigchld_rfd_in(struct io_conn *conn,
* features later, or adding them when supplied by plugins. */
static struct feature_set *default_features(const tal_t *ctx)
{
/* BOLT PR https://github.com/lightning/bolts/pull/1092
* suggests making the following compulsory:
* var_onion_optin (all but 6 nodes)
* gossip_queries (all but 11 nodes)
* option_data_loss_protect (all but 11 nodes)
* option_static_remotekey (all but 16 nodes)
*/
struct feature_set *ret = NULL;
static const u32 features[] = {
OPTIONAL_FEATURE(OPT_DATA_LOSS_PROTECT),
COMPULSORY_FEATURE(OPT_DATA_LOSS_PROTECT),
OPTIONAL_FEATURE(OPT_UPFRONT_SHUTDOWN_SCRIPT),
OPTIONAL_FEATURE(OPT_GOSSIP_QUERIES),
COMPULSORY_FEATURE(OPT_VAR_ONION),
Expand Down
4 changes: 2 additions & 2 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3577,9 +3577,9 @@ def test_nonstatic_channel(node_factory, bitcoind):
"""Smoke test for a channel without option_static_remotekey"""
l1, l2 = node_factory.line_graph(2,
opts=[{},
# needs at least 15 to connect
# needs at least 1 and 15 to connect
# (and 9 is a dependent)
{'dev-force-features': '9,15////////'}])
{'dev-force-features': '1,9,15////////'}])
chan = only_one(l1.rpc.listpeerchannels()['channels'])
assert 'option_static_remotekey' not in chan['features']
assert 'option_anchor' not in chan['features']
Expand Down
2 changes: 1 addition & 1 deletion tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2243,7 +2243,7 @@ def test_dev_demux(node_factory):
def test_list_features_only(node_factory):
features = subprocess.check_output(['lightningd/lightningd',
'--list-features-only']).decode('utf-8').splitlines()
expected = ['option_data_loss_protect/odd',
expected = ['option_data_loss_protect/even',
'option_upfront_shutdown_script/odd',
'option_gossip_queries/odd',
'option_var_onion_optin/even',
Expand Down
4 changes: 2 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def hex_bits(features):

def expected_peer_features(extra=[]):
"""Return the expected peer features hexstring for this configuration"""
features = [1, 5, 7, 8, 11, 13, 14, 17, 19, 25, 27, 45, 47, 51]
features = [0, 5, 7, 8, 11, 13, 14, 17, 19, 25, 27, 45, 47, 51]
if EXPERIMENTAL_DUAL_FUND:
# option_dual_fund
features += [29]
Expand All @@ -50,7 +50,7 @@ def expected_peer_features(extra=[]):
# features for the 'node' and the 'peer' feature sets
def expected_node_features(extra=[]):
"""Return the expected node features hexstring for this configuration"""
features = [1, 5, 7, 8, 11, 13, 14, 17, 19, 25, 27, 45, 47, 51, 55]
features = [0, 5, 7, 8, 11, 13, 14, 17, 19, 25, 27, 45, 47, 51, 55]
if EXPERIMENTAL_DUAL_FUND:
# option_dual_fund
features += [29]
Expand Down

0 comments on commit dd953cf

Please sign in to comment.