5151//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information).
5252//! - `DualFund` - requires/supports V2 channel establishment
5353//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-establishment-v2) for more information).
54+ //! - `SimpleClose` - requires/supports simplified closing negotiation
55+ //! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_complete-and-closing_sig) for more information).
5456//! - `OnionMessages` - requires/supports forwarding onion messages
5557//! (see [BOLT-7](https://github.com/lightning/bolts/pull/759/files) for more information).
5658// TODO: update link
@@ -161,7 +163,7 @@ mod sealed {
161163 // Byte 6
162164 ZeroConf ,
163165 // Byte 7
164- Trampoline ,
166+ Trampoline | SimpleClose ,
165167 ]
166168 ) ;
167169 define_context ! (
@@ -182,7 +184,7 @@ mod sealed {
182184 // Byte 6
183185 ZeroConf | Keysend ,
184186 // Byte 7
185- Trampoline ,
187+ Trampoline | SimpleClose ,
186188 // Byte 8 - 31
187189 , , , , , , , , , , , , , , , , , , , , , , , ,
188190 // Byte 32
@@ -660,9 +662,20 @@ mod sealed {
660662 supports_trampoline_routing,
661663 requires_trampoline_routing
662664 ) ;
663- // By default, allocate enough bytes to cover up to Trampoline. Update this as new features are
665+ define_feature ! (
666+ 61 ,
667+ SimpleClose ,
668+ [ InitContext , NodeContext ] ,
669+ "Feature flags for simplified closing negotiation." ,
670+ set_simple_close_optional,
671+ set_simple_close_required,
672+ clear_simple_close,
673+ supports_simple_close,
674+ requires_simple_close
675+ ) ;
676+ // By default, allocate enough bytes to cover up to SimpleClose. Update this as new features are
664677 // added which we expect to appear commonly across contexts.
665- pub ( super ) const MIN_FEATURES_ALLOCATION_BYTES : usize = ( 57 + 7 ) / 8 ;
678+ pub ( super ) const MIN_FEATURES_ALLOCATION_BYTES : usize = ( 61 + 7 ) / 8 ;
666679 define_feature ! (
667680 259 ,
668681 DnsResolver ,
@@ -1355,6 +1368,7 @@ mod tests {
13551368 init_features. set_scid_privacy_optional ( ) ;
13561369 init_features. set_zero_conf_optional ( ) ;
13571370 init_features. set_quiescence_optional ( ) ;
1371+ init_features. set_simple_close_optional ( ) ;
13581372
13591373 assert ! ( init_features. initial_routing_sync( ) ) ;
13601374 assert ! ( !init_features. supports_upfront_shutdown_script( ) ) ;
@@ -1370,14 +1384,16 @@ mod tests {
13701384 // - onion_messages
13711385 // - option_channel_type | option_scid_alias
13721386 // - option_zeroconf
1373- assert_eq ! ( node_features. flags. len( ) , 7 ) ;
1387+ // - option_simple_close
1388+ assert_eq ! ( node_features. flags. len( ) , 8 ) ;
13741389 assert_eq ! ( node_features. flags[ 0 ] , 0b00000001 ) ;
13751390 assert_eq ! ( node_features. flags[ 1 ] , 0b01010001 ) ;
13761391 assert_eq ! ( node_features. flags[ 2 ] , 0b10001010 ) ;
13771392 assert_eq ! ( node_features. flags[ 3 ] , 0b00001010 ) ;
13781393 assert_eq ! ( node_features. flags[ 4 ] , 0b10001000 ) ;
13791394 assert_eq ! ( node_features. flags[ 5 ] , 0b10100000 ) ;
13801395 assert_eq ! ( node_features. flags[ 6 ] , 0b00001000 ) ;
1396+ assert_eq ! ( node_features. flags[ 7 ] , 0b00100000 ) ;
13811397 }
13821398
13831399 // Check that cleared flags are kept blank when converting back:
0 commit comments