8080//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-quiescence) for more information).
8181//! - `ZeroFeeCommitments` - A channel type which always uses zero transaction fee on commitment transactions.
8282//! (see [BOLT PR #1228](https://github.com/lightning/bolts/pull/1228) for more info).
83+ //! - `Splice` - Allows replacing the currently-locked funding transaction with a new one
84+ //! (see [BOLT PR #1160](https://github.com/lightning/bolts/pull/1160) for more information).
8385//!
8486//! LDK knows about the following features, but does not support them:
8587//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
@@ -163,7 +165,7 @@ mod sealed {
163165 // Byte 6
164166 ZeroConf ,
165167 // Byte 7
166- Trampoline | SimpleClose ,
168+ Trampoline | SimpleClose | Splice ,
167169 ]
168170 ) ;
169171 define_context ! (
@@ -184,7 +186,7 @@ mod sealed {
184186 // Byte 6
185187 ZeroConf | Keysend ,
186188 // Byte 7
187- Trampoline | SimpleClose ,
189+ Trampoline | SimpleClose | Splice ,
188190 // Byte 8 - 31
189191 , , , , , , , , , , , , , , , , , , , , , , , ,
190192 // Byte 32
@@ -673,9 +675,20 @@ mod sealed {
673675 supports_simple_close,
674676 requires_simple_close
675677 ) ;
676- // By default, allocate enough bytes to cover up to SimpleClose. Update this as new features are
678+ define_feature ! (
679+ 63 ,
680+ Splice ,
681+ [ InitContext , NodeContext ] ,
682+ "Feature flags for channel splicing." ,
683+ set_splicing_optional,
684+ set_splicing_required,
685+ clear_splicing,
686+ supports_splicing,
687+ requires_splicing
688+ ) ;
689+ // By default, allocate enough bytes to cover up to Splice. Update this as new features are
677690 // added which we expect to appear commonly across contexts.
678- pub ( super ) const MIN_FEATURES_ALLOCATION_BYTES : usize = ( 61 + 7 ) / 8 ;
691+ pub ( super ) const MIN_FEATURES_ALLOCATION_BYTES : usize = ( 63 + 7 ) / 8 ;
679692 define_feature ! (
680693 259 ,
681694 DnsResolver ,
@@ -1369,6 +1382,7 @@ mod tests {
13691382 init_features. set_zero_conf_optional ( ) ;
13701383 init_features. set_quiescence_optional ( ) ;
13711384 init_features. set_simple_close_optional ( ) ;
1385+ init_features. set_splicing_optional ( ) ;
13721386
13731387 assert ! ( init_features. initial_routing_sync( ) ) ;
13741388 assert ! ( !init_features. supports_upfront_shutdown_script( ) ) ;
@@ -1384,7 +1398,7 @@ mod tests {
13841398 // - onion_messages
13851399 // - option_channel_type | option_scid_alias
13861400 // - option_zeroconf
1387- // - option_simple_close
1401+ // - option_simple_close | option_splice
13881402 assert_eq ! ( node_features. flags. len( ) , 8 ) ;
13891403 assert_eq ! ( node_features. flags[ 0 ] , 0b00000001 ) ;
13901404 assert_eq ! ( node_features. flags[ 1 ] , 0b01010001 ) ;
@@ -1393,7 +1407,7 @@ mod tests {
13931407 assert_eq ! ( node_features. flags[ 4 ] , 0b10001000 ) ;
13941408 assert_eq ! ( node_features. flags[ 5 ] , 0b10100000 ) ;
13951409 assert_eq ! ( node_features. flags[ 6 ] , 0b00001000 ) ;
1396- assert_eq ! ( node_features. flags[ 7 ] , 0b00100000 ) ;
1410+ assert_eq ! ( node_features. flags[ 7 ] , 0b10100000 ) ;
13971411 }
13981412
13991413 // Check that cleared flags are kept blank when converting back:
0 commit comments