@@ -3796,6 +3796,29 @@ pub struct ClaimAlongRouteArgs<'a, 'b, 'c, 'd> {
37963796 pub origin_node : & ' a Node < ' b , ' c , ' d > ,
37973797 pub expected_paths : & ' a [ & ' a [ & ' a Node < ' b , ' c , ' d > ] ] ,
37983798 pub expected_extra_fees : Vec < u32 > ,
3799+ /// A one-off adjustment used only in tests to account for an existing
3800+ /// fee-handling trade-off in LDK.
3801+ ///
3802+ /// When the payer is the introduction node of a blinded path, LDK does not
3803+ /// subtract the forward fee for the `payer -> next_hop` channel
3804+ /// (see [`BlindedPaymentPath::advance_path_by_one`]). This keeps the fee
3805+ /// logic simpler at the cost of a small, intentional overpayment.
3806+ ///
3807+ /// In the simple two-hop case (payer as introduction node → payee),
3808+ /// this overpayment has historically been avoided by simply not charging
3809+ /// the payer the forward fee, since the payer knows there is only
3810+ /// a single hop after them.
3811+ ///
3812+ /// However, with the introduction of dummy hops in LDK v3.0, even a
3813+ /// two-node real path (payer as introduction node → payee) may appear as a
3814+ /// multi-hop blinded path. This makes the existing overpayment surface in
3815+ /// tests.
3816+ ///
3817+ /// Until the fee-handling trade-off is revisited, this field allows tests
3818+ /// to compensate for that expected difference.
3819+ ///
3820+ /// [`BlindedPaymentPath::advance_path_by_one`]: crate::blinded_path::payment::BlindedPaymentPath::advance_path_by_one
3821+ pub expected_extra_total_fees_msat : u64 ,
37993822 pub expected_min_htlc_overpay : Vec < u32 > ,
38003823 pub skip_last : bool ,
38013824 pub payment_preimage : PaymentPreimage ,
@@ -3819,6 +3842,7 @@ impl<'a, 'b, 'c, 'd> ClaimAlongRouteArgs<'a, 'b, 'c, 'd> {
38193842 origin_node,
38203843 expected_paths,
38213844 expected_extra_fees : vec ! [ 0 ; expected_paths. len( ) ] ,
3845+ expected_extra_total_fees_msat : 0 ,
38223846 expected_min_htlc_overpay : vec ! [ 0 ; expected_paths. len( ) ] ,
38233847 skip_last : false ,
38243848 payment_preimage,
@@ -3834,6 +3858,10 @@ impl<'a, 'b, 'c, 'd> ClaimAlongRouteArgs<'a, 'b, 'c, 'd> {
38343858 self . expected_extra_fees = extra_fees;
38353859 self
38363860 }
3861+ pub fn with_expected_extra_total_fees_msat ( mut self , extra_total_fees : u64 ) -> Self {
3862+ self . expected_extra_total_fees_msat = extra_total_fees;
3863+ self
3864+ }
38373865 pub fn with_expected_min_htlc_overpay ( mut self , extra_fees : Vec < u32 > ) -> Self {
38383866 self . expected_min_htlc_overpay = extra_fees;
38393867 self
@@ -3858,6 +3886,7 @@ pub fn pass_claimed_payment_along_route(args: ClaimAlongRouteArgs) -> u64 {
38583886 payment_preimage : our_payment_preimage,
38593887 allow_1_msat_fee_overpay,
38603888 custom_tlvs,
3889+ ..
38613890 } = args;
38623891 let claim_event = expected_paths[ 0 ] . last ( ) . unwrap ( ) . node . get_and_clear_pending_events ( ) ;
38633892 assert_eq ! ( claim_event. len( ) , 1 ) ;
@@ -4096,7 +4125,9 @@ pub fn claim_payment_along_route(
40964125 let origin_node = args. origin_node ;
40974126 let payment_preimage = args. payment_preimage ;
40984127 let skip_last = args. skip_last ;
4099- let expected_total_fee_msat = do_claim_payment_along_route ( args) ;
4128+ let expected_extra_total_fees_msat = args. expected_extra_total_fees_msat ;
4129+ let mut expected_total_fee_msat = do_claim_payment_along_route ( args) ;
4130+ expected_total_fee_msat += expected_extra_total_fees_msat;
41004131 if !skip_last {
41014132 expect_payment_sent ! ( origin_node, payment_preimage, Some ( expected_total_fee_msat) )
41024133 } else {
0 commit comments