Skip to content

Commit 2633754

Browse files
Aditya SharmaAditya Sharma
authored andcommitted
lightning: Add provide_peer_backup_storage to InitContext and NodeContext.
1 parent d35239c commit 2633754

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
@@ -68,6 +68,8 @@
6868
//! (see the [`Keysend` feature assignment proposal](https://github.com/lightning/bolts/issues/605#issuecomment-606679798) for more information).
6969
//! - `Trampoline` - supports receiving and forwarding Trampoline payments
7070
//! (see the [`Trampoline` feature proposal](https://github.com/lightning/bolts/pull/836) for more information).
71+
//! - `provide_peer_backup_storage` - Indicates that we offer the capability to store data of our peers
72+
//! (see https://github.com/lightning/bolts/pull/1110 for more info).
7173
//!
7274
//! LDK knows about the following features, but does not support them:
7375
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
@@ -151,7 +153,7 @@ mod sealed {
151153
// Byte 4
152154
OnionMessages,
153155
// Byte 5
154-
ChannelType | SCIDPrivacy,
156+
ProvidePeerBackupStorage | ChannelType | SCIDPrivacy,
155157
// Byte 6
156158
ZeroConf,
157159
// Byte 7
@@ -172,7 +174,7 @@ mod sealed {
172174
// Byte 4
173175
OnionMessages,
174176
// Byte 5
175-
ChannelType | SCIDPrivacy,
177+
ProvidePeerBackupStorage | ChannelType | SCIDPrivacy,
176178
// Byte 6
177179
ZeroConf | Keysend,
178180
// Byte 7
@@ -519,6 +521,16 @@ mod sealed {
519521
supports_onion_messages,
520522
requires_onion_messages
521523
);
524+
define_feature!(
525+
43,
526+
ProvidePeerBackupStorage,
527+
[InitContext, NodeContext],
528+
"Feature flags for `provide_peer_backup_storage`.",
529+
set_provide_peer_backup_storage_optional,
530+
set_provide_peer_backup_storage_required,
531+
supports_provide_peer_storage,
532+
requires_provide_peer_storage
533+
);
522534
define_feature!(
523535
45,
524536
ChannelType,
@@ -1157,6 +1169,14 @@ mod tests {
11571169
assert!(!features1.requires_unknown_bits_from(&features2));
11581170
assert!(!features2.requires_unknown_bits_from(&features1));
11591171

1172+
features1.set_provide_peer_backup_storage_required();
1173+
assert!(features1.requires_unknown_bits_from(&features2));
1174+
assert!(!features2.requires_unknown_bits_from(&features1));
1175+
1176+
features2.set_provide_peer_backup_storage_optional();
1177+
assert!(!features1.requires_unknown_bits_from(&features2));
1178+
assert!(!features2.requires_unknown_bits_from(&features1));
1179+
11601180
features1.set_data_loss_protect_required();
11611181
assert!(features1.requires_unknown_bits_from(&features2));
11621182
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
@@ -11076,6 +11076,7 @@ pub fn provided_init_features(config: &UserConfig) -> InitFeatures {
1107611076
features.set_scid_privacy_optional();
1107711077
features.set_zero_conf_optional();
1107811078
features.set_route_blinding_optional();
11079+
features.set_provide_peer_backup_storage_optional();
1107911080
if config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx {
1108011081
features.set_anchors_zero_fee_htlc_tx_optional();
1108111082
}

0 commit comments

Comments
 (0)