@@ -2731,6 +2731,7 @@ pub struct ClaimAlongRouteArgs<'a, 'b, 'c, 'd> {
2731
2731
pub expected_min_htlc_overpay : Vec < u32 > ,
2732
2732
pub skip_last : bool ,
2733
2733
pub payment_preimage : PaymentPreimage ,
2734
+ pub custom_tlvs : Vec < ( u64 , Vec < u8 > ) > ,
2734
2735
// Allow forwarding nodes to have taken 1 msat more fee than expected based on the downstream
2735
2736
// fulfill amount.
2736
2737
//
@@ -2749,7 +2750,7 @@ impl<'a, 'b, 'c, 'd> ClaimAlongRouteArgs<'a, 'b, 'c, 'd> {
2749
2750
Self {
2750
2751
origin_node, expected_paths, expected_extra_fees : vec ! [ 0 ; expected_paths. len( ) ] ,
2751
2752
expected_min_htlc_overpay : vec ! [ 0 ; expected_paths. len( ) ] , skip_last : false , payment_preimage,
2752
- allow_1_msat_fee_overpay : false ,
2753
+ allow_1_msat_fee_overpay : false , custom_tlvs : vec ! [ ] ,
2753
2754
}
2754
2755
}
2755
2756
pub fn skip_last ( mut self , skip_last : bool ) -> Self {
@@ -2768,12 +2769,16 @@ impl<'a, 'b, 'c, 'd> ClaimAlongRouteArgs<'a, 'b, 'c, 'd> {
2768
2769
self . allow_1_msat_fee_overpay = true ;
2769
2770
self
2770
2771
}
2772
+ pub fn with_custom_tlvs ( mut self , custom_tlvs : Vec < ( u64 , Vec < u8 > ) > ) -> Self {
2773
+ self . custom_tlvs = custom_tlvs;
2774
+ self
2775
+ }
2771
2776
}
2772
2777
2773
- pub fn pass_claimed_payment_along_route < ' a , ' b , ' c , ' d > ( args : ClaimAlongRouteArgs ) -> u64 {
2778
+ pub fn pass_claimed_payment_along_route ( args : ClaimAlongRouteArgs ) -> u64 {
2774
2779
let ClaimAlongRouteArgs {
2775
2780
origin_node, expected_paths, expected_extra_fees, expected_min_htlc_overpay, skip_last,
2776
- payment_preimage : our_payment_preimage, allow_1_msat_fee_overpay,
2781
+ payment_preimage : our_payment_preimage, allow_1_msat_fee_overpay, custom_tlvs ,
2777
2782
} = args;
2778
2783
let claim_event = expected_paths[ 0 ] . last ( ) . unwrap ( ) . node . get_and_clear_pending_events ( ) ;
2779
2784
assert_eq ! ( claim_event. len( ) , 1 ) ;
@@ -2787,11 +2792,13 @@ pub fn pass_claimed_payment_along_route<'a, 'b, 'c, 'd>(args: ClaimAlongRouteArg
2787
2792
| PaymentPurpose :: Bolt12RefundPayment { payment_preimage : Some ( preimage) , .. } ,
2788
2793
amount_msat,
2789
2794
ref htlcs,
2795
+ ref onion_fields,
2790
2796
..
2791
2797
} => {
2792
2798
assert_eq ! ( preimage, our_payment_preimage) ;
2793
2799
assert_eq ! ( htlcs. len( ) , expected_paths. len( ) ) ; // One per path.
2794
2800
assert_eq ! ( htlcs. iter( ) . map( |h| h. value_msat) . sum:: <u64 >( ) , amount_msat) ;
2801
+ assert_eq ! ( onion_fields. as_ref( ) . unwrap( ) . custom_tlvs, custom_tlvs) ;
2795
2802
expected_paths. iter ( ) . zip ( htlcs) . for_each ( |( path, htlc) | check_claimed_htlc_channel ( origin_node, path, htlc) ) ;
2796
2803
fwd_amt_msat = amount_msat;
2797
2804
} ,
@@ -2802,11 +2809,13 @@ pub fn pass_claimed_payment_along_route<'a, 'b, 'c, 'd>(args: ClaimAlongRouteArg
2802
2809
payment_hash,
2803
2810
amount_msat,
2804
2811
ref htlcs,
2812
+ ref onion_fields,
2805
2813
..
2806
2814
} => {
2807
2815
assert_eq ! ( & payment_hash. 0 , & Sha256 :: hash( & our_payment_preimage. 0 ) [ ..] ) ;
2808
2816
assert_eq ! ( htlcs. len( ) , expected_paths. len( ) ) ; // One per path.
2809
2817
assert_eq ! ( htlcs. iter( ) . map( |h| h. value_msat) . sum:: <u64 >( ) , amount_msat) ;
2818
+ assert_eq ! ( onion_fields. as_ref( ) . unwrap( ) . custom_tlvs, custom_tlvs) ;
2810
2819
expected_paths. iter ( ) . zip ( htlcs) . for_each ( |( path, htlc) | check_claimed_htlc_channel ( origin_node, path, htlc) ) ;
2811
2820
fwd_amt_msat = amount_msat;
2812
2821
}
0 commit comments