Skip to content

Commit aaab2d4

Browse files
Aditya SharmaAditya Sharma
Aditya Sharma
authored and
Aditya Sharma
committed
Add 'ProvidePeerBackupStorage' to 'InitContext' and 'NodeContext'
Introduce the 'ProvidePeerBackupStorage' 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 'ProvidePeerBackupStorage' to the 'InitContext' & 'NodeContext'. - Set feature bit for this feature inside 'provide_init_features()'
1 parent 1434e9c commit aaab2d4

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+
//! - `ProvidePeerBackupStorage` - 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+
ProvidePeerBackupStorage | 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+
ProvidePeerBackupStorage | 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+
ProvidePeerBackupStorage,
552+
[InitContext, NodeContext],
553+
"Feature flags for `provide_peer_backup_storage`.",
554+
set_provide_peer_backup_storage_optional,
555+
set_provide_peer_backup_storage_required,
556+
supports_provide_peer_storage,
557+
requires_provide_peer_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_peer_backup_storage_required();
1142+
assert!(features1.requires_unknown_bits_from(&features2));
1143+
assert!(!features2.requires_unknown_bits_from(&features1));
1144+
1145+
features2.set_provide_peer_backup_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
@@ -12347,6 +12347,7 @@ pub fn provided_init_features(config: &UserConfig) -> InitFeatures {
1234712347
features.set_scid_privacy_optional();
1234812348
features.set_zero_conf_optional();
1234912349
features.set_route_blinding_optional();
12350+
features.set_provide_peer_backup_storage_optional();
1235012351
if config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx {
1235112352
features.set_anchors_zero_fee_htlc_tx_optional();
1235212353
}

0 commit comments

Comments
 (0)