@@ -251,7 +251,7 @@ mod sealed {
251
251
/// useful for manipulating feature flags.
252
252
macro_rules! define_feature {
253
253
( $odd_bit: expr, $feature: ident, [ $( $context: ty) ,+] , $doc: expr, $optional_setter: ident,
254
- $required_setter: ident, $supported_getter: ident) => {
254
+ $required_setter: ident, $clear : ident , $ supported_getter: ident) => {
255
255
#[ doc = $doc]
256
256
///
257
257
/// See [BOLT #9] for details.
@@ -354,6 +354,11 @@ mod sealed {
354
354
<T as $feature>:: set_required_bit( & mut self . flags) ;
355
355
}
356
356
357
+ /// Unsets this feature.
358
+ pub fn $clear( & mut self ) {
359
+ <T as $feature>:: clear_bits( & mut self . flags) ;
360
+ }
361
+
357
362
/// Checks if this feature is supported.
358
363
pub fn $supported_getter( & self ) -> bool {
359
364
<T as $feature>:: supports_feature( & self . flags)
@@ -377,8 +382,8 @@ mod sealed {
377
382
) *
378
383
} ;
379
384
( $odd_bit: expr, $feature: ident, [ $( $context: ty) ,+] , $doc: expr, $optional_setter: ident,
380
- $required_setter: ident, $supported_getter: ident, $required_getter: ident) => {
381
- define_feature!( $odd_bit, $feature, [ $( $context) ,+] , $doc, $optional_setter, $required_setter, $supported_getter) ;
385
+ $required_setter: ident, $clear : ident , $ supported_getter: ident, $required_getter: ident) => {
386
+ define_feature!( $odd_bit, $feature, [ $( $context) ,+] , $doc, $optional_setter, $required_setter, $clear , $ supported_getter) ;
382
387
impl <T : $feature> Features <T > {
383
388
/// Checks if this feature is required.
384
389
pub fn $required_getter( & self ) -> bool {
@@ -395,6 +400,7 @@ mod sealed {
395
400
"Feature flags for `option_data_loss_protect`." ,
396
401
set_data_loss_protect_optional,
397
402
set_data_loss_protect_required,
403
+ clear_data_loss_protect,
398
404
supports_data_loss_protect,
399
405
requires_data_loss_protect
400
406
) ;
@@ -406,6 +412,7 @@ mod sealed {
406
412
"Feature flags for `initial_routing_sync`." ,
407
413
set_initial_routing_sync_optional,
408
414
set_initial_routing_sync_required,
415
+ clear_initial_routing_sync,
409
416
initial_routing_sync
410
417
) ;
411
418
define_feature ! (
@@ -415,6 +422,7 @@ mod sealed {
415
422
"Feature flags for `option_upfront_shutdown_script`." ,
416
423
set_upfront_shutdown_script_optional,
417
424
set_upfront_shutdown_script_required,
425
+ clear_upfront_shutdown_script,
418
426
supports_upfront_shutdown_script,
419
427
requires_upfront_shutdown_script
420
428
) ;
@@ -425,6 +433,7 @@ mod sealed {
425
433
"Feature flags for `gossip_queries`." ,
426
434
set_gossip_queries_optional,
427
435
set_gossip_queries_required,
436
+ clear_gossip_queries,
428
437
supports_gossip_queries,
429
438
requires_gossip_queries
430
439
) ;
@@ -435,6 +444,7 @@ mod sealed {
435
444
"Feature flags for `var_onion_optin`." ,
436
445
set_variable_length_onion_optional,
437
446
set_variable_length_onion_required,
447
+ clear_variable_length_onion,
438
448
supports_variable_length_onion,
439
449
requires_variable_length_onion
440
450
) ;
@@ -445,6 +455,7 @@ mod sealed {
445
455
"Feature flags for `option_static_remotekey`." ,
446
456
set_static_remote_key_optional,
447
457
set_static_remote_key_required,
458
+ clear_static_remote_key,
448
459
supports_static_remote_key,
449
460
requires_static_remote_key
450
461
) ;
@@ -455,6 +466,7 @@ mod sealed {
455
466
"Feature flags for `payment_secret`." ,
456
467
set_payment_secret_optional,
457
468
set_payment_secret_required,
469
+ clear_payment_secret,
458
470
supports_payment_secret,
459
471
requires_payment_secret
460
472
) ;
@@ -465,6 +477,7 @@ mod sealed {
465
477
"Feature flags for `basic_mpp`." ,
466
478
set_basic_mpp_optional,
467
479
set_basic_mpp_required,
480
+ clear_basic_mpp,
468
481
supports_basic_mpp,
469
482
requires_basic_mpp
470
483
) ;
@@ -475,6 +488,7 @@ mod sealed {
475
488
"Feature flags for `option_support_large_channel` (aka wumbo channels)." ,
476
489
set_wumbo_optional,
477
490
set_wumbo_required,
491
+ clear_wumbo,
478
492
supports_wumbo,
479
493
requires_wumbo
480
494
) ;
@@ -485,6 +499,7 @@ mod sealed {
485
499
"Feature flags for `option_anchors_nonzero_fee_htlc_tx`." ,
486
500
set_anchors_nonzero_fee_htlc_tx_optional,
487
501
set_anchors_nonzero_fee_htlc_tx_required,
502
+ clear_anchors_nonzero_fee_htlc_tx,
488
503
supports_anchors_nonzero_fee_htlc_tx,
489
504
requires_anchors_nonzero_fee_htlc_tx
490
505
) ;
@@ -495,6 +510,7 @@ mod sealed {
495
510
"Feature flags for `option_anchors_zero_fee_htlc_tx`." ,
496
511
set_anchors_zero_fee_htlc_tx_optional,
497
512
set_anchors_zero_fee_htlc_tx_required,
513
+ clear_anchors_zero_fee_htlc_tx,
498
514
supports_anchors_zero_fee_htlc_tx,
499
515
requires_anchors_zero_fee_htlc_tx
500
516
) ;
@@ -505,6 +521,7 @@ mod sealed {
505
521
"Feature flags for `option_route_blinding`." ,
506
522
set_route_blinding_optional,
507
523
set_route_blinding_required,
524
+ clear_route_blinding,
508
525
supports_route_blinding,
509
526
requires_route_blinding
510
527
) ;
@@ -515,6 +532,7 @@ mod sealed {
515
532
"Feature flags for `opt_shutdown_anysegwit`." ,
516
533
set_shutdown_any_segwit_optional,
517
534
set_shutdown_any_segwit_required,
535
+ clear_shutdown_anysegwit,
518
536
supports_shutdown_anysegwit,
519
537
requires_shutdown_anysegwit
520
538
) ;
@@ -525,6 +543,7 @@ mod sealed {
525
543
"Feature flags for `option_dual_fund`." ,
526
544
set_dual_fund_optional,
527
545
set_dual_fund_required,
546
+ clear_dual_fund,
528
547
supports_dual_fund,
529
548
requires_dual_fund
530
549
) ;
@@ -535,6 +554,7 @@ mod sealed {
535
554
"Feature flags for `option_taproot`." ,
536
555
set_taproot_optional,
537
556
set_taproot_required,
557
+ clear_taproot,
538
558
supports_taproot,
539
559
requires_taproot
540
560
) ;
@@ -545,6 +565,7 @@ mod sealed {
545
565
"Feature flags for `option_quiesce`." ,
546
566
set_quiescence_optional,
547
567
set_quiescence_required,
568
+ clear_quiescence,
548
569
supports_quiescence,
549
570
requires_quiescence
550
571
) ;
@@ -555,6 +576,7 @@ mod sealed {
555
576
"Feature flags for `option_onion_messages`." ,
556
577
set_onion_messages_optional,
557
578
set_onion_messages_required,
579
+ clear_onion_messages,
558
580
supports_onion_messages,
559
581
requires_onion_messages
560
582
) ;
@@ -565,6 +587,7 @@ mod sealed {
565
587
"Feature flags for `option_provide_storage`." ,
566
588
set_provide_storage_optional,
567
589
set_provide_storage_required,
590
+ clear_provide_storage,
568
591
supports_provide_storage,
569
592
requires_provide_storage
570
593
) ;
@@ -575,19 +598,28 @@ mod sealed {
575
598
"Feature flags for `option_channel_type`." ,
576
599
set_channel_type_optional,
577
600
set_channel_type_required,
601
+ clear_channel_type,
578
602
supports_channel_type,
579
603
requires_channel_type
580
604
) ;
581
- define_feature ! ( 47 , SCIDPrivacy , [ InitContext , NodeContext , ChannelTypeContext ] ,
605
+ define_feature ! ( 47 ,
606
+ SCIDPrivacy ,
607
+ [ InitContext , NodeContext , ChannelTypeContext ] ,
582
608
"Feature flags for only forwarding with SCID aliasing. Called `option_scid_alias` in the BOLTs" ,
583
- set_scid_privacy_optional, set_scid_privacy_required, supports_scid_privacy, requires_scid_privacy) ;
609
+ set_scid_privacy_optional,
610
+ set_scid_privacy_required,
611
+ clear_scid_privacy,
612
+ supports_scid_privacy,
613
+ requires_scid_privacy
614
+ ) ;
584
615
define_feature ! (
585
616
49 ,
586
617
PaymentMetadata ,
587
618
[ Bolt11InvoiceContext ] ,
588
619
"Feature flags for payment metadata in invoices." ,
589
620
set_payment_metadata_optional,
590
621
set_payment_metadata_required,
622
+ clear_payment_metadata,
591
623
supports_payment_metadata,
592
624
requires_payment_metadata
593
625
) ;
@@ -601,6 +633,7 @@ mod sealed {
601
633
"Feature flags for keysend payments." ,
602
634
set_keysend_optional,
603
635
set_keysend_required,
636
+ clear_keysend,
604
637
supports_keysend,
605
638
requires_keysend
606
639
) ;
@@ -611,6 +644,7 @@ mod sealed {
611
644
"Feature flags for Trampoline routing." ,
612
645
set_trampoline_routing_optional,
613
646
set_trampoline_routing_required,
647
+ clear_trampoline_routing,
614
648
supports_trampoline_routing,
615
649
requires_trampoline_routing
616
650
) ;
@@ -621,6 +655,7 @@ mod sealed {
621
655
"Feature flags for DNS resolving." ,
622
656
set_dns_resolution_optional,
623
657
set_dns_resolution_required,
658
+ clear_dns_resolution,
624
659
supports_dns_resolution,
625
660
requires_dns_resolution
626
661
) ;
@@ -643,6 +678,7 @@ mod sealed {
643
678
"Feature flags for an unknown feature used in testing." ,
644
679
set_unknown_feature_optional,
645
680
set_unknown_feature_required,
681
+ clear_unknown_feature,
646
682
supports_unknown_test_feature,
647
683
requires_unknown_test_feature
648
684
) ;
@@ -1038,48 +1074,6 @@ impl<T: sealed::Context> Features<T> {
1038
1074
}
1039
1075
}
1040
1076
1041
- impl < T : sealed:: UpfrontShutdownScript > Features < T > {
1042
- /// Unsets the `upfront_shutdown_script` feature
1043
- pub fn clear_upfront_shutdown_script ( & mut self ) {
1044
- <T as sealed:: UpfrontShutdownScript >:: clear_bits ( & mut self . flags ) ;
1045
- }
1046
- }
1047
-
1048
- impl < T : sealed:: ShutdownAnySegwit > Features < T > {
1049
- /// Unsets the `shutdown_anysegwit` feature
1050
- pub fn clear_shutdown_anysegwit ( & mut self ) {
1051
- <T as sealed:: ShutdownAnySegwit >:: clear_bits ( & mut self . flags ) ;
1052
- }
1053
- }
1054
-
1055
- impl < T : sealed:: Wumbo > Features < T > {
1056
- /// Unsets the `wumbo` feature
1057
- pub fn clear_wumbo ( & mut self ) {
1058
- <T as sealed:: Wumbo >:: clear_bits ( & mut self . flags ) ;
1059
- }
1060
- }
1061
-
1062
- impl < T : sealed:: SCIDPrivacy > Features < T > {
1063
- /// Unsets the `scid_privacy` feature
1064
- pub fn clear_scid_privacy ( & mut self ) {
1065
- <T as sealed:: SCIDPrivacy >:: clear_bits ( & mut self . flags ) ;
1066
- }
1067
- }
1068
-
1069
- impl < T : sealed:: AnchorsZeroFeeHtlcTx > Features < T > {
1070
- /// Unsets the `anchors_zero_fee_htlc_tx` feature
1071
- pub fn clear_anchors_zero_fee_htlc_tx ( & mut self ) {
1072
- <T as sealed:: AnchorsZeroFeeHtlcTx >:: clear_bits ( & mut self . flags ) ;
1073
- }
1074
- }
1075
-
1076
- impl < T : sealed:: RouteBlinding > Features < T > {
1077
- /// Unsets the `route_blinding` feature
1078
- pub fn clear_route_blinding ( & mut self ) {
1079
- <T as sealed:: RouteBlinding >:: clear_bits ( & mut self . flags ) ;
1080
- }
1081
- }
1082
-
1083
1077
#[ cfg( any( test, feature = "_test_utils" ) ) ]
1084
1078
impl < T : sealed:: UnknownFeature > Features < T > {
1085
1079
/// Sets an unknown feature for testing
0 commit comments