@@ -20,11 +20,10 @@ use crate::routing::router::PaymentParameters;
2020use crate :: sign:: ecdsa:: EcdsaChannelSigner ;
2121use crate :: sign:: tx_builder:: { SpecTxBuilder , TxBuilder } ;
2222use crate :: types:: features:: ChannelTypeFeatures ;
23- use crate :: types:: payment:: PaymentPreimage ;
23+ use crate :: types:: payment:: { PaymentHash , PaymentPreimage } ;
2424use crate :: util:: config:: UserConfig ;
2525use crate :: util:: errors:: APIError ;
2626
27- use bolt11_invoice:: PaymentHash ;
2827use lightning_macros:: xtest;
2928
3029use bitcoin:: secp256k1:: { Secp256k1 , SecretKey } ;
@@ -2443,7 +2442,7 @@ pub fn do_test_dust_limit_fee_accounting(can_afford: bool) {
24432442 }
24442443}
24452444
2446- #[ test ]
2445+ #[ xtest ( feature = "_externalize_tests" ) ]
24472446fn test_create_channel_to_trusted_peer_0reserve ( ) {
24482447 let mut config = test_default_channel_config ( ) ;
24492448
@@ -2466,7 +2465,6 @@ fn test_create_channel_to_trusted_peer_0reserve() {
24662465 assert_eq ! ( channel_type, ChannelTypeFeatures :: anchors_zero_fee_commitments( ) ) ;
24672466}
24682467
2469- #[ cfg( test) ]
24702468fn do_test_create_channel_to_trusted_peer_0reserve ( mut config : UserConfig ) -> ChannelTypeFeatures {
24712469 let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
24722470 let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
@@ -2530,7 +2528,7 @@ fn do_test_create_channel_to_trusted_peer_0reserve(mut config: UserConfig) -> Ch
25302528 channel_type
25312529}
25322530
2533- #[ test ]
2531+ #[ xtest ( feature = "_externalize_tests" ) ]
25342532fn test_accept_inbound_channel_from_trusted_peer_0reserve ( ) {
25352533 let mut config = test_default_channel_config ( ) ;
25362534
@@ -2553,7 +2551,6 @@ fn test_accept_inbound_channel_from_trusted_peer_0reserve() {
25532551 assert_eq ! ( channel_type, ChannelTypeFeatures :: anchors_zero_fee_commitments( ) ) ;
25542552}
25552553
2556- #[ cfg( test) ]
25572554fn do_test_accept_inbound_channel_from_trusted_peer_0reserve (
25582555 mut config : UserConfig ,
25592556) -> ChannelTypeFeatures {
@@ -2656,7 +2653,7 @@ enum LegacyChannelsNoOutputs {
26562653 FailsReceiverCanAcceptHTLCB ,
26572654}
26582655
2659- #[ test ]
2656+ #[ xtest ( feature = "_externalize_tests" ) ]
26602657fn test_zero_reserve_no_outputs ( ) {
26612658 do_test_zero_reserve_no_outputs_legacy ( LegacyChannelsNoOutputs :: PaymentSucceeds ) ;
26622659 do_test_zero_reserve_no_outputs_legacy ( LegacyChannelsNoOutputs :: FailsReceiverCanAcceptHTLCA ) ;
@@ -2773,7 +2770,6 @@ fn do_test_zero_reserve_no_outputs_legacy(no_outputs_case: LegacyChannelsNoOutpu
27732770
27742771 let feerate_per_kw = 253 ;
27752772 let spike_multiple = FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE as u32 ;
2776- let anchors_sat = 0 ;
27772773 let dust_limit_satoshis: u64 = 546 ;
27782774 // This is the fundee 1000sat reserve + 2 min HTLCs
27792775 let channel_value_sat = 1002 ;
@@ -2788,7 +2784,6 @@ fn do_test_zero_reserve_no_outputs_legacy(no_outputs_case: LegacyChannelsNoOutpu
27882784 let max_dust_htlc_sat = dust_limit_satoshis + success_tx_fee_sat - 1 ;
27892785 assert ! (
27902786 channel_value_sat
2791- . saturating_sub( anchors_sat)
27922787 . saturating_sub( commit_tx_fee_sat( feerate_per_kw, 0 , & channel_type) )
27932788 . saturating_sub( max_dust_htlc_sat)
27942789 < dust_limit_satoshis
@@ -3220,7 +3215,6 @@ fn do_test_zero_reserve_no_outputs_p2a_anchor() {
32203215 let _node_b_id = nodes[ 1 ] . node . get_our_node_id ( ) ;
32213216
32223217 let feerate_per_kw = 253 ;
3223- let anchors_sat = 0 ;
32243218 let dust_limit_satoshis: u64 = 546 ;
32253219 // This is the fundee 1000sat reserve + 2 min HTLCs
32263220 let channel_value_sat = 1002 ;
@@ -3233,7 +3227,6 @@ fn do_test_zero_reserve_no_outputs_p2a_anchor() {
32333227 let max_dust_htlc_sat = dust_limit_satoshis - 1 ;
32343228 assert ! (
32353229 channel_value_sat
3236- . saturating_sub( anchors_sat)
32373230 . saturating_sub( commit_tx_fee_sat( feerate_per_kw, 0 , & channel_type) )
32383231 . saturating_sub( max_dust_htlc_sat)
32393232 < dust_limit_satoshis
@@ -3251,12 +3244,11 @@ fn do_test_zero_reserve_no_outputs_p2a_anchor() {
32513244
32523245 send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , sender_amount_msat) ;
32533246 // Node 1 the fundee has 0-reserve too, so whatever they receive, they can send right back!
3254- // Node 0 should *always* have the funds to cover the fee of a single non-dust HTLC from node 1.
32553247 assert_eq ! ( nodes[ 1 ] . node. list_channels( ) [ 0 ] . next_outbound_htlc_limit_msat, sender_amount_msat) ;
32563248 send_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , sender_amount_msat) ;
32573249}
32583250
3259- #[ test ]
3251+ #[ xtest ( feature = "_externalize_tests" ) ]
32603252fn test_zero_reserve_zero_conf_combined ( ) {
32613253 // Test that zero-reserve and zero-conf features work together: a channel that
32623254 // is immediately usable (no confirmations needed) and has zero reserve for the opener.
0 commit comments