Skip to content

Commit 14a78e5

Browse files
Aditya SharmaAditya Sharma
authored andcommitted
lightning: Add provide_peer_backup_storage to InitContext and NodeContext.
add to features vala...
1 parent 70e4001 commit 14a78e5

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9817,6 +9817,7 @@ pub fn provided_init_features(config: &UserConfig) -> InitFeatures {
98179817
features.set_scid_privacy_optional();
98189818
features.set_zero_conf_optional();
98199819
features.set_route_blinding_optional();
9820+
features.set_provide_peer_backup_storage_optional();
98209821
if config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx {
98219822
features.set_anchors_zero_fee_htlc_tx_optional();
98229823
}

lightning/src/ln/features.rs

Lines changed: 15 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
@@ -169,7 +171,7 @@ mod sealed {
169171
// Byte 4
170172
OnionMessages,
171173
// Byte 5
172-
ChannelType | SCIDPrivacy,
174+
ProvidePeerBackupStorage | ChannelType | SCIDPrivacy,
173175
// Byte 6
174176
ZeroConf | Keysend,
175177
// Byte 7
@@ -413,6 +415,9 @@ mod sealed {
413415
define_feature!(39, OnionMessages, [InitContext, NodeContext],
414416
"Feature flags for `option_onion_messages`.", set_onion_messages_optional,
415417
set_onion_messages_required, supports_onion_messages, requires_onion_messages);
418+
define_feature!(43, ProvidePeerBackupStorage, [InitContext, NodeContext],
419+
"Feature flags for `provide_peer_backup_storage`.", set_provide_peer_backup_storage_optional,
420+
set_provide_peer_backup_storage_required, supports_provide_peer_storage, requires_provide_peer_storage);
416421
define_feature!(45, ChannelType, [InitContext, NodeContext],
417422
"Feature flags for `option_channel_type`.", set_channel_type_optional,
418423
set_channel_type_required, supports_channel_type, requires_channel_type);
@@ -1045,6 +1050,14 @@ mod tests {
10451050
assert!(!features1.requires_unknown_bits_from(&features2));
10461051
assert!(!features2.requires_unknown_bits_from(&features1));
10471052

1053+
features1.set_provide_peer_backup_storage_required();
1054+
assert!(features1.requires_unknown_bits_from(&features2));
1055+
assert!(!features2.requires_unknown_bits_from(&features1));
1056+
1057+
features2.set_provide_peer_backup_storage_optional();
1058+
assert!(!features1.requires_unknown_bits_from(&features2));
1059+
assert!(!features2.requires_unknown_bits_from(&features1));
1060+
10481061
features1.set_data_loss_protect_required();
10491062
assert!(features1.requires_unknown_bits_from(&features2));
10501063
assert!(!features2.requires_unknown_bits_from(&features1));

0 commit comments

Comments
 (0)