File tree Expand file tree Collapse file tree 3 files changed +31
-1
lines changed
Expand file tree Collapse file tree 3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 8383//! (see [BOLT PR #1160](https://github.com/lightning/bolts/pull/1160) for more information).
8484//! - `HtlcHold` - requires/supports holding HTLCs and forwarding on receipt of an onion message
8585//! (see [BOLT-2](https://github.com/lightning/bolts/pull/989/files) for more information).
86+ //! - `MessagePaddingPrototype` - requires/supports padding of network messages for improved privacy
87+ //! (see [BOLT-1](TODO) for more information).
8688//!
8789//! LDK knows about the following features, but does not support them:
8890//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
@@ -174,7 +176,7 @@ mod sealed {
174176 // Byte 18
175177 ,
176178 // Byte 19
177- HtlcHold | SplicePrototype ,
179+ HtlcHold | SplicePrototype | MessagePaddingPrototype ,
178180 ]
179181 ) ;
180182 define_context ! (
@@ -732,6 +734,17 @@ mod sealed {
732734 supports_splicing,
733735 requires_splicing
734736 ) ;
737+ define_feature ! (
738+ 165 , // BOLTs PR uses 64/65, so add +100
739+ MessagePaddingPrototype ,
740+ [ InitContext ] ,
741+ "Feature flags for network message padding." ,
742+ set_message_padding_optional,
743+ set_message_padding_required,
744+ clear_message_padding,
745+ supports_message_padding,
746+ requires_message_padding
747+ ) ;
735748 define_feature ! (
736749 259 ,
737750 DnsResolver ,
Original file line number Diff line number Diff line change @@ -15876,6 +15876,14 @@ pub fn provided_init_features(config: &UserConfig) -> InitFeatures {
1587615876 features.set_htlc_hold_optional();
1587715877 }
1587815878
15879+ if config.enable_htlc_hold {
15880+ features.set_htlc_hold_optional();
15881+ }
15882+
15883+ if config.enable_message_padding {
15884+ features.set_message_padding_optional();
15885+ }
15886+
1587915887 features
1588015888}
1588115889
Original file line number Diff line number Diff line change @@ -973,6 +973,14 @@ pub struct UserConfig {
973973 ///
974974 /// [`ChannelManager::splice_channel`]: crate::ln::channelmanager::ChannelManager::splice_channel
975975 pub reject_inbound_splices : bool ,
976+ /// If this set to `true`, then we will negotiate support for padding network messages with our
977+ /// counterparty. If both parties agree, network messages will be padded to a fixed length to
978+ /// improve privacy in the face of an adversary monitoring network traffic.
979+ ///
980+ /// Nodes which are heavily bandwidth-restricted might want to set this to `false`.
981+ ///
982+ /// Default value: `true`
983+ pub enable_message_padding : bool ,
976984}
977985
978986impl Default for UserConfig {
@@ -990,6 +998,7 @@ impl Default for UserConfig {
990998 enable_htlc_hold : false ,
991999 hold_outbound_htlcs_at_next_hop : false ,
9921000 reject_inbound_splices : true ,
1001+ enable_message_padding : true ,
9931002 }
9941003 }
9951004}
You can’t perform that action at this time.
0 commit comments