51
51
//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information).
52
52
//! - `DualFund` - requires/supports V2 channel establishment
53
53
//! (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).
54
56
//! - `OnionMessages` - requires/supports forwarding onion messages
55
57
//! (see [BOLT-7](https://github.com/lightning/bolts/pull/759/files) for more information).
56
58
// TODO: update link
@@ -161,7 +163,7 @@ mod sealed {
161
163
// Byte 6
162
164
ZeroConf ,
163
165
// Byte 7
164
- Trampoline ,
166
+ Trampoline | SimpleClose ,
165
167
]
166
168
) ;
167
169
define_context ! (
@@ -182,7 +184,7 @@ mod sealed {
182
184
// Byte 6
183
185
ZeroConf | Keysend ,
184
186
// Byte 7
185
- Trampoline ,
187
+ Trampoline | SimpleClose ,
186
188
// Byte 8 - 31
187
189
, , , , , , , , , , , , , , , , , , , , , , , ,
188
190
// Byte 32
@@ -660,9 +662,20 @@ mod sealed {
660
662
supports_trampoline_routing,
661
663
requires_trampoline_routing
662
664
) ;
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
664
677
// 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 ;
666
679
define_feature ! (
667
680
259 ,
668
681
DnsResolver ,
@@ -1355,6 +1368,7 @@ mod tests {
1355
1368
init_features. set_scid_privacy_optional ( ) ;
1356
1369
init_features. set_zero_conf_optional ( ) ;
1357
1370
init_features. set_quiescence_optional ( ) ;
1371
+ init_features. set_simple_close_optional ( ) ;
1358
1372
1359
1373
assert ! ( init_features. initial_routing_sync( ) ) ;
1360
1374
assert ! ( !init_features. supports_upfront_shutdown_script( ) ) ;
@@ -1370,14 +1384,16 @@ mod tests {
1370
1384
// - onion_messages
1371
1385
// - option_channel_type | option_scid_alias
1372
1386
// - option_zeroconf
1373
- assert_eq ! ( node_features. flags. len( ) , 7 ) ;
1387
+ // - option_simple_close
1388
+ assert_eq ! ( node_features. flags. len( ) , 8 ) ;
1374
1389
assert_eq ! ( node_features. flags[ 0 ] , 0b00000001 ) ;
1375
1390
assert_eq ! ( node_features. flags[ 1 ] , 0b01010001 ) ;
1376
1391
assert_eq ! ( node_features. flags[ 2 ] , 0b10001010 ) ;
1377
1392
assert_eq ! ( node_features. flags[ 3 ] , 0b00001010 ) ;
1378
1393
assert_eq ! ( node_features. flags[ 4 ] , 0b10001000 ) ;
1379
1394
assert_eq ! ( node_features. flags[ 5 ] , 0b10100000 ) ;
1380
1395
assert_eq ! ( node_features. flags[ 6 ] , 0b00001000 ) ;
1396
+ assert_eq ! ( node_features. flags[ 7 ] , 0b00100000 ) ;
1381
1397
}
1382
1398
1383
1399
// Check that cleared flags are kept blank when converting back:
0 commit comments