Skip to content

Commit b7e20b3

Browse files
committed
lightningd: enable peer storage by default,
Now we've make it only on existing channels, and not have to call listdatastore every time, that means we can safely turn it on by default. Changelog-Added: Protocol: we now offer peer storage to any peers who create a channel. Changelog-Deprecated: Config: `--experimental-peer-storage` (it's now the default). Signed-off-by: Rusty Russell <[email protected]>
1 parent 40dfbcc commit b7e20b3

File tree

7 files changed

+18
-38
lines changed

7 files changed

+18
-38
lines changed

doc/lightningd-config.5.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -811,12 +811,6 @@ The operations will be bundled into a single transaction. The channel will remai
811811
active while awaiting splice confirmation, however you can only spend the smaller
812812
of the prior channel balance and the new one.
813813

814-
* **experimental-peer-storage**
815-
816-
Specifying this option means we will store up to 64k of encrypted
817-
data for our peers, and give them our (encrypted!) backup data to
818-
store as well, based on a protocol similar to [bolt][bolt] #881.
819-
820814
* **experimental-quiesce**
821815

822816
Specifying this option advertizes `option_quiesce`. Not very useful

lightningd/lightningd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,7 @@ static struct feature_set *default_features(const tal_t *ctx)
931931
OPTIONAL_FEATURE(OPT_ONION_MESSAGES),
932932
OPTIONAL_FEATURE(OPT_CHANNEL_TYPE),
933933
OPTIONAL_FEATURE(OPT_ROUTE_BLINDING),
934+
OPTIONAL_FEATURE(OPT_PROVIDE_STORAGE),
934935
/* Removed later for elements */
935936
OPTIONAL_FEATURE(OPT_ANCHORS_ZERO_FEE_HTLC_TX),
936937
};

lightningd/options.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,9 +1260,9 @@ static char *opt_set_shutdown_wrong_funding(struct lightningd *ld)
12601260

12611261
static char *opt_set_peer_storage(struct lightningd *ld)
12621262
{
1263-
feature_set_or(ld->our_features,
1264-
take(feature_set_for_feature(NULL,
1265-
OPTIONAL_FEATURE(OPT_PROVIDE_STORAGE))));
1263+
if (!opt_deprecated_ok(ld, "experimental-peer-storage", NULL,
1264+
"v25.05", "v25.11"))
1265+
return "--experimental-peer-storage is now enabled by default";
12661266
return NULL;
12671267
}
12681268

@@ -1472,7 +1472,7 @@ static void register_opts(struct lightningd *ld)
14721472
"EXPERIMENTAL: allow shutdown with alternate txids");
14731473
opt_register_early_noarg("--experimental-peer-storage",
14741474
opt_set_peer_storage, ld,
1475-
"EXPERIMENTAL: enable peer backup storage and restore");
1475+
opt_hidden);
14761476
opt_register_early_noarg("--experimental-quiesce",
14771477
opt_set_quiesce, ld,
14781478
"experimental: Advertise ability to quiesce"

tests/test_cln_rs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,9 @@ def test_grpc_custommsg_notification(node_factory):
452452
l2.rpc.sendcustommsg(l1.info["id"], "3131313174657374")
453453

454454
for custommsg in custommsg_stream:
455+
# Ignore peer storage message!
456+
if custommsg.payload.hex().startswith('0007'):
457+
continue
455458
assert custommsg.peer_id.hex() == l2.info["id"]
456459
assert custommsg.payload.hex() == "3131313174657374"
457460
assert custommsg.payload == b"1111test"

tests/test_misc.py

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,6 +2404,7 @@ def test_list_features_only(node_factory):
24042404
'option_shutdown_anysegwit/odd',
24052405
'option_quiesce/odd',
24062406
'option_onion_messages/odd',
2407+
'option_provide_storage/odd',
24072408
'option_channel_type/odd',
24082409
'option_scid_alias/odd',
24092410
'option_zeroconf/odd']
@@ -3088,27 +3089,11 @@ def test_emergencyrecover(node_factory, bitcoind):
30883089
@pytest.mark.openchannel('v1')
30893090
@pytest.mark.openchannel('v2')
30903091
def test_recover_plugin(node_factory, bitcoind):
3091-
l1 = node_factory.get_node(
3092-
may_reconnect=True,
3093-
allow_warning=True,
3094-
feerates=(7500, 7500, 7500, 7500),
3095-
options={
3096-
'log-level': 'info',
3097-
'experimental-peer-storage': None,
3098-
'dev-no-reconnect': None,
3099-
},
3100-
)
3101-
l2 = node_factory.get_node(
3102-
may_reconnect=True,
3103-
feerates=(7500, 7500, 7500, 7500),
3104-
broken_log='.*',
3105-
allow_bad_gossip=True,
3106-
options={
3107-
'log-level': 'info',
3108-
'experimental-peer-storage': None,
3109-
'dev-no-reconnect': None,
3110-
},
3111-
)
3092+
l1, l2 = node_factory.get_nodes(2, opts=[{'may_reconnect': True,
3093+
'dev-no-reconnect': None},
3094+
{'may_reconnect': True,
3095+
'dev-no-reconnect': None,
3096+
'broken_log': 'Cannot broadcast our commitment tx: they have a future one|ERROR: Unknown commitment #[0-9]*, recovering our funds!'}])
31123097

31133098
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
31143099
l2.fundchannel(l1, 10**6)
@@ -3159,11 +3144,9 @@ def test_restorefrompeer(node_factory, bitcoind):
31593144
Test restorefrompeer
31603145
"""
31613146
l1, l2 = node_factory.get_nodes(2, [{'broken_log': 'ERROR: Unknown commitment #.*, recovering our funds!',
3162-
'experimental-peer-storage': None,
31633147
'may_reconnect': True,
31643148
'allow_bad_gossip': True},
3165-
{'experimental-peer-storage': None,
3166-
'may_reconnect': True}])
3149+
{'may_reconnect': True}])
31673150

31683151
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
31693152

tests/test_plugin.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4563,8 +4563,7 @@ def write_all(fd, bytestr):
45634563
def test_peer_storage(node_factory, bitcoind):
45644564
"""Test that we offer and re-xmit peer storage for our peers if they have a channel or are explicitly enabled"""
45654565
l1, l2, l3 = node_factory.get_nodes(3,
4566-
opts={'experimental-peer-storage': None,
4567-
'may_reconnect': True,
4566+
opts={'may_reconnect': True,
45684567
'dev-no-reconnect': None})
45694568

45704569
# Connect them, no peer storage yet anyway.

tests/utils.py

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

4242
def expected_peer_features(extra=[]):
4343
"""Return the expected peer features hexstring for this configuration"""
44-
features = [0, 5, 7, 8, 11, 12, 14, 17, 19, 25, 27, 35, 39, 45, 47, 51]
44+
features = [0, 5, 7, 8, 11, 12, 14, 17, 19, 25, 27, 35, 39, 43, 45, 47, 51]
4545
if EXPERIMENTAL_DUAL_FUND:
4646
# option_dual_fund
4747
features += [29]
@@ -57,7 +57,7 @@ def expected_peer_features(extra=[]):
5757
# features for the 'node' and the 'peer' feature sets
5858
def expected_node_features(extra=[]):
5959
"""Return the expected node features hexstring for this configuration"""
60-
features = [0, 5, 7, 8, 11, 12, 14, 17, 19, 25, 27, 35, 39, 45, 47, 51, 55]
60+
features = [0, 5, 7, 8, 11, 12, 14, 17, 19, 25, 27, 35, 39, 43, 45, 47, 51, 55]
6161
if EXPERIMENTAL_DUAL_FUND:
6262
# option_dual_fund
6363
features += [29]

0 commit comments

Comments
 (0)