Skip to content

Commit 6ff17f1

Browse files
Aditya SharmaAditya Sharma
authored andcommitted
lightning: Add provide_peer_backup_storage to InitContext and NodeContext.
1 parent d1e88bc commit 6ff17f1

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
@@ -10786,6 +10786,7 @@ pub fn provided_init_features(config: &UserConfig) -> InitFeatures {
1078610786
features.set_scid_privacy_optional();
1078710787
features.set_zero_conf_optional();
1078810788
features.set_route_blinding_optional();
10789+
features.set_provide_peer_backup_storage_optional();
1078910790
if config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx {
1079010791
features.set_anchors_zero_fee_htlc_tx_optional();
1079110792
}

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
@@ -153,7 +155,7 @@ mod sealed {
153155
// Byte 4
154156
OnionMessages,
155157
// Byte 5
156-
ChannelType | SCIDPrivacy,
158+
ProvidePeerBackupStorage | ChannelType | SCIDPrivacy,
157159
// Byte 6
158160
ZeroConf,
159161
// 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
@@ -415,6 +417,9 @@ mod sealed {
415417
define_feature!(39, OnionMessages, [InitContext, NodeContext],
416418
"Feature flags for `option_onion_messages`.", set_onion_messages_optional,
417419
set_onion_messages_required, supports_onion_messages, requires_onion_messages);
420+
define_feature!(43, ProvidePeerBackupStorage, [InitContext, NodeContext],
421+
"Feature flags for `provide_peer_backup_storage`.", set_provide_peer_backup_storage_optional,
422+
set_provide_peer_backup_storage_required, supports_provide_peer_storage, requires_provide_peer_storage);
418423
define_feature!(45, ChannelType, [InitContext, NodeContext],
419424
"Feature flags for `option_channel_type`.", set_channel_type_optional,
420425
set_channel_type_required, supports_channel_type, requires_channel_type);
@@ -1083,6 +1088,14 @@ mod tests {
10831088
assert!(!features1.requires_unknown_bits_from(&features2));
10841089
assert!(!features2.requires_unknown_bits_from(&features1));
10851090

1091+
features1.set_provide_peer_backup_storage_required();
1092+
assert!(features1.requires_unknown_bits_from(&features2));
1093+
assert!(!features2.requires_unknown_bits_from(&features1));
1094+
1095+
features2.set_provide_peer_backup_storage_optional();
1096+
assert!(!features1.requires_unknown_bits_from(&features2));
1097+
assert!(!features2.requires_unknown_bits_from(&features1));
1098+
10861099
features1.set_data_loss_protect_required();
10871100
assert!(features1.requires_unknown_bits_from(&features2));
10881101
assert!(!features2.requires_unknown_bits_from(&features1));

0 commit comments

Comments
 (0)