Skip to content

Commit 0222296

Browse files
Aditya Sharmaadi2011
Aditya Sharma
authored andcommitted
Add 'ProvideStorage' to 'InitContext' and 'NodeContext'
Introduce the 'ProvideStorage' feature to enable nodes to distribute and store peer storage backups for channel partners. This functionality enhances resilience by ensuring critical peer data is backed up and can be retrieved if needed. - Added 'ProvideStorage' to the 'InitContext' & 'NodeContext'. - Set feature bit for this feature inside 'provide_init_features()'
1 parent 21f38c9 commit 0222296

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

lightning-types/src/features.rs

+22-2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
//! (see the [`Trampoline` feature proposal](https://github.com/lightning/bolts/pull/836) for more information).
7373
//! - `DnsResolver` - supports resolving DNS names to TXT DNSSEC proofs for BIP 353 payments
7474
//! (see [bLIP 32](https://github.com/lightning/blips/blob/master/blip-0032.md) for more information).
75+
//! - `ProvideStorage` - Indicates that we offer the capability to store data of our peers
76+
//! (see https://github.com/lightning/bolts/pull/1110 for more info).
7577
//!
7678
//! LDK knows about the following features, but does not support them:
7779
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
@@ -152,7 +154,7 @@ mod sealed {
152154
// Byte 4
153155
OnionMessages,
154156
// Byte 5
155-
ChannelType | SCIDPrivacy,
157+
ProvideStorage | ChannelType | SCIDPrivacy,
156158
// Byte 6
157159
ZeroConf,
158160
// Byte 7
@@ -173,7 +175,7 @@ mod sealed {
173175
// Byte 4
174176
OnionMessages,
175177
// Byte 5
176-
ChannelType | SCIDPrivacy,
178+
ProvideStorage | ChannelType | SCIDPrivacy,
177179
// Byte 6
178180
ZeroConf | Keysend,
179181
// Byte 7
@@ -544,6 +546,16 @@ mod sealed {
544546
supports_onion_messages,
545547
requires_onion_messages
546548
);
549+
define_feature!(
550+
43,
551+
ProvideStorage,
552+
[InitContext, NodeContext],
553+
"Feature flags for `option_provide_storage`.",
554+
set_provide_storage_optional,
555+
set_provide_storage_required,
556+
supports_provide_storage,
557+
requires_provide_storage
558+
);
547559
define_feature!(
548560
45,
549561
ChannelType,
@@ -1126,6 +1138,14 @@ mod tests {
11261138
assert!(!features1.requires_unknown_bits_from(&features2));
11271139
assert!(!features2.requires_unknown_bits_from(&features1));
11281140

1141+
features1.set_provide_storage_required();
1142+
assert!(features1.requires_unknown_bits_from(&features2));
1143+
assert!(!features2.requires_unknown_bits_from(&features1));
1144+
1145+
features2.set_provide_storage_optional();
1146+
assert!(!features1.requires_unknown_bits_from(&features2));
1147+
assert!(!features2.requires_unknown_bits_from(&features1));
1148+
11291149
features1.set_data_loss_protect_required();
11301150
assert!(features1.requires_unknown_bits_from(&features2));
11311151
assert!(!features2.requires_unknown_bits_from(&features1));

lightning/src/ln/channelmanager.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12425,6 +12425,7 @@ pub fn provided_init_features(config: &UserConfig) -> InitFeatures {
1242512425
features.set_scid_privacy_optional();
1242612426
features.set_zero_conf_optional();
1242712427
features.set_route_blinding_optional();
12428+
features.set_provide_storage_optional();
1242812429
if config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx {
1242912430
features.set_anchors_zero_fee_htlc_tx_optional();
1243012431
}

0 commit comments

Comments
 (0)