80
80
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-quiescence) for more information).
81
81
//! - `ZeroFeeCommitments` - A channel type which always uses zero transaction fee on commitment transactions.
82
82
//! (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).
83
85
//!
84
86
//! LDK knows about the following features, but does not support them:
85
87
//! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be
@@ -163,7 +165,7 @@ mod sealed {
163
165
// Byte 6
164
166
ZeroConf ,
165
167
// Byte 7
166
- Trampoline | SimpleClose ,
168
+ Trampoline | SimpleClose | Splice ,
167
169
]
168
170
) ;
169
171
define_context ! (
@@ -184,7 +186,7 @@ mod sealed {
184
186
// Byte 6
185
187
ZeroConf | Keysend ,
186
188
// Byte 7
187
- Trampoline | SimpleClose ,
189
+ Trampoline | SimpleClose | Splice ,
188
190
// Byte 8 - 31
189
191
, , , , , , , , , , , , , , , , , , , , , , , ,
190
192
// Byte 32
@@ -673,9 +675,20 @@ mod sealed {
673
675
supports_simple_close,
674
676
requires_simple_close
675
677
) ;
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
677
690
// 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 ;
679
692
define_feature ! (
680
693
259 ,
681
694
DnsResolver ,
@@ -1369,6 +1382,7 @@ mod tests {
1369
1382
init_features. set_zero_conf_optional ( ) ;
1370
1383
init_features. set_quiescence_optional ( ) ;
1371
1384
init_features. set_simple_close_optional ( ) ;
1385
+ init_features. set_splicing_optional ( ) ;
1372
1386
1373
1387
assert ! ( init_features. initial_routing_sync( ) ) ;
1374
1388
assert ! ( !init_features. supports_upfront_shutdown_script( ) ) ;
@@ -1384,7 +1398,7 @@ mod tests {
1384
1398
// - onion_messages
1385
1399
// - option_channel_type | option_scid_alias
1386
1400
// - option_zeroconf
1387
- // - option_simple_close
1401
+ // - option_simple_close | option_splice
1388
1402
assert_eq ! ( node_features. flags. len( ) , 8 ) ;
1389
1403
assert_eq ! ( node_features. flags[ 0 ] , 0b00000001 ) ;
1390
1404
assert_eq ! ( node_features. flags[ 1 ] , 0b01010001 ) ;
@@ -1393,7 +1407,7 @@ mod tests {
1393
1407
assert_eq ! ( node_features. flags[ 4 ] , 0b10001000 ) ;
1394
1408
assert_eq ! ( node_features. flags[ 5 ] , 0b10100000 ) ;
1395
1409
assert_eq ! ( node_features. flags[ 6 ] , 0b00001000 ) ;
1396
- assert_eq ! ( node_features. flags[ 7 ] , 0b00100000 ) ;
1410
+ assert_eq ! ( node_features. flags[ 7 ] , 0b10100000 ) ;
1397
1411
}
1398
1412
1399
1413
// Check that cleared flags are kept blank when converting back:
0 commit comments