Skip to content

Commit 8c64b1d

Browse files
Aditya SharmaAditya Sharma
authored andcommitted
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 ad19d93 commit 8c64b1d

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

lightning-types/src/features.rs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
//! (see the [`Trampoline` feature proposal](https://github.com/lightning/bolts/pull/836) for more information).
7171
//! - `DnsResolver` - supports resolving DNS names to TXT DNSSEC proofs for BIP 353 payments
7272
//! (see [bLIP 32](https://github.com/lightning/blips/blob/master/blip-0032.md) for more information).
73+
//! - `ProvidePeerBackupStorage` - Indicates that we offer the capability to store data of our peers
74+
//! (see https://github.com/lightning/bolts/pull/1110 for more info).
7375
//!
7476
//! LDK knows about the following features, but does not support them:
7577
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
@@ -150,7 +152,7 @@ mod sealed {
150152
// Byte 4
151153
OnionMessages,
152154
// Byte 5
153-
ChannelType | SCIDPrivacy,
155+
ProvidePeerBackupStorage | ChannelType | SCIDPrivacy,
154156
// Byte 6
155157
ZeroConf,
156158
// Byte 7
@@ -171,7 +173,7 @@ mod sealed {
171173
// Byte 4
172174
OnionMessages,
173175
// Byte 5
174-
ChannelType | SCIDPrivacy,
176+
ProvidePeerBackupStorage | ChannelType | SCIDPrivacy,
175177
// Byte 6
176178
ZeroConf | Keysend,
177179
// Byte 7
@@ -522,6 +524,16 @@ mod sealed {
522524
supports_onion_messages,
523525
requires_onion_messages
524526
);
527+
define_feature!(
528+
43,
529+
ProvidePeerBackupStorage,
530+
[InitContext, NodeContext],
531+
"Feature flags for `provide_peer_backup_storage`.",
532+
set_provide_peer_backup_storage_optional,
533+
set_provide_peer_backup_storage_required,
534+
supports_provide_peer_storage,
535+
requires_provide_peer_storage
536+
);
525537
define_feature!(
526538
45,
527539
ChannelType,
@@ -1104,6 +1116,14 @@ mod tests {
11041116
assert!(!features1.requires_unknown_bits_from(&features2));
11051117
assert!(!features2.requires_unknown_bits_from(&features1));
11061118

1119+
features1.set_provide_peer_backup_storage_required();
1120+
assert!(features1.requires_unknown_bits_from(&features2));
1121+
assert!(!features2.requires_unknown_bits_from(&features1));
1122+
1123+
features2.set_provide_peer_backup_storage_optional();
1124+
assert!(!features1.requires_unknown_bits_from(&features2));
1125+
assert!(!features2.requires_unknown_bits_from(&features1));
1126+
11071127
features1.set_data_loss_protect_required();
11081128
assert!(features1.requires_unknown_bits_from(&features2));
11091129
assert!(!features2.requires_unknown_bits_from(&features1));

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11415,6 +11415,7 @@ pub fn provided_init_features(config: &UserConfig) -> InitFeatures {
1141511415
features.set_scid_privacy_optional();
1141611416
features.set_zero_conf_optional();
1141711417
features.set_route_blinding_optional();
11418+
features.set_provide_peer_backup_storage_optional();
1141811419
if config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx {
1141911420
features.set_anchors_zero_fee_htlc_tx_optional();
1142011421
}

0 commit comments

Comments
 (0)