Skip to content

Commit e7956e4

Browse files
Aditya SharmaAditya Sharma
Aditya Sharma
authored and
Aditya Sharma
committed
lightning: Add and to InitContext and NodeContext.
1 parent 75822b8 commit e7956e4

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

lightning/src/ln/channelmanager.rs

+2
Original file line numberDiff line numberDiff line change
@@ -9605,6 +9605,8 @@ pub fn provided_init_features(config: &UserConfig) -> InitFeatures {
96059605
features.set_scid_privacy_optional();
96069606
features.set_zero_conf_optional();
96079607
features.set_route_blinding_optional();
9608+
features.set_want_peer_backup_storage_optional();
9609+
features.set_provide_peer_backup_storage_optional();
96089610
if config.channel_handshake_config.negotiate_anchors_zero_fee_htlc_tx {
96099611
features.set_anchors_zero_fee_htlc_tx_optional();
96109612
}

lightning/src/ln/features.rs

+28-2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@
6666
//! for more info).
6767
//! - `Keysend` - send funds to a node without an invoice
6868
//! (see the [`Keysend` feature assignment proposal](https://github.com/lightning/bolts/issues/605#issuecomment-606679798) for more information).
69+
//! - `want_peer_backup_storage` - Indicates that the node desires peers that offer peer storage
70+
//! (see https://github.com/lightning/bolts/pull/1110 for more info).
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).
6973
//!
7074
//! LDK knows about the following features, but does not support them:
7175
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
@@ -149,7 +153,7 @@ mod sealed {
149153
// Byte 4
150154
OnionMessages,
151155
// Byte 5
152-
ChannelType | SCIDPrivacy,
156+
WantPeerBackupStorage | ProvidePeerBackupStorage | ChannelType | SCIDPrivacy,
153157
// Byte 6
154158
ZeroConf,
155159
]);
@@ -165,7 +169,7 @@ mod sealed {
165169
// Byte 4
166170
OnionMessages,
167171
// Byte 5
168-
ChannelType | SCIDPrivacy,
172+
WantPeerBackupStorage | ProvidePeerBackupStorage | ChannelType | SCIDPrivacy,
169173
// Byte 6
170174
ZeroConf | Keysend,
171175
]);
@@ -405,6 +409,12 @@ mod sealed {
405409
define_feature!(39, OnionMessages, [InitContext, NodeContext],
406410
"Feature flags for `option_onion_messages`.", set_onion_messages_optional,
407411
set_onion_messages_required, supports_onion_messages, requires_onion_messages);
412+
define_feature!(41, WantPeerBackupStorage, [InitContext, NodeContext],
413+
"Feature flags for `want_peer_backup_storage`.", set_want_peer_backup_storage_optional,
414+
set_want_peer_backup_storage_required, supports_want_peer_storage, requires_want_peer_storage);
415+
define_feature!(43, ProvidePeerBackupStorage, [InitContext, NodeContext],
416+
"Feature flags for `provide_peer_backup_storage`.", set_provide_peer_backup_storage_optional,
417+
set_provide_peer_backup_storage_required, supports_provide_peer_storage, requires_provide_peer_storage);
408418
define_feature!(45, ChannelType, [InitContext, NodeContext],
409419
"Feature flags for `option_channel_type`.", set_channel_type_optional,
410420
set_channel_type_required, supports_channel_type, requires_channel_type);
@@ -1034,6 +1044,22 @@ mod tests {
10341044
assert!(!features1.requires_unknown_bits_from(&features2));
10351045
assert!(!features2.requires_unknown_bits_from(&features1));
10361046

1047+
features1.set_want_peer_backup_storage_required();
1048+
assert!(features1.requires_unknown_bits_from(&features2));
1049+
assert!(!features2.requires_unknown_bits_from(&features1));
1050+
1051+
features2.set_want_peer_backup_storage_optional();
1052+
assert!(!features1.requires_unknown_bits_from(&features2));
1053+
assert!(!features2.requires_unknown_bits_from(&features1));
1054+
1055+
features1.set_provide_peer_backup_storage_required();
1056+
assert!(features1.requires_unknown_bits_from(&features2));
1057+
assert!(!features2.requires_unknown_bits_from(&features1));
1058+
1059+
features2.set_provide_peer_backup_storage_optional();
1060+
assert!(!features1.requires_unknown_bits_from(&features2));
1061+
assert!(!features2.requires_unknown_bits_from(&features1));
1062+
10371063
features1.set_data_loss_protect_required();
10381064
assert!(features1.requires_unknown_bits_from(&features2));
10391065
assert!(!features2.requires_unknown_bits_from(&features1));

0 commit comments

Comments
 (0)