@@ -1425,20 +1425,24 @@ where
14251425 }
14261426 }
14271427
1428- // We only allow multiple HTLCs in/out for trampoline forwards, which have not yet
1429- // been fully implemented in LDK, so we do not lose any information by just
1430- // reporting the first HTLC in each vec.
1431- debug_assert_eq ! ( prev_htlcs. len( ) , 1 , "unexpected number of prev_htlcs" ) ;
1432- debug_assert_eq ! ( next_htlcs. len( ) , 1 , "unexpected number of next_htlcs" ) ;
1433- let next_htlc = next_htlcs
1434- . first ( )
1435- . expect ( "we expect at least one next_htlc for PaymentForwarded" ) ;
1436-
1428+ // We only expect multiple next_htlcs when we have a trampoline forward, and we do
1429+ // not support JIT channels in combination with trampoline. We're not at risk of
1430+ // double-reporting a skimmed fee when we have multiple next_htlcs because we
1431+ // expect our skimmed fee to be zero.
1432+ if skimmed_fee_msat. is_some ( ) {
1433+ debug_assert_eq ! (
1434+ next_htlcs. len( ) ,
1435+ 1 ,
1436+ "unexpected skimmed fee for trampoline forward, fee may be double counted"
1437+ ) ;
1438+ }
14371439 if let Some ( liquidity_source) = self . liquidity_source . as_ref ( ) {
14381440 let skimmed_fee_msat = skimmed_fee_msat. unwrap_or ( 0 ) ;
1439- liquidity_source
1440- . handle_payment_forwarded ( Some ( next_htlc. channel_id ) , skimmed_fee_msat)
1441- . await ;
1441+ for next_htlc in next_htlcs. iter ( ) {
1442+ liquidity_source
1443+ . handle_payment_forwarded ( Some ( next_htlc. channel_id ) , skimmed_fee_msat)
1444+ . await ;
1445+ }
14421446 }
14431447
14441448 let event = Event :: PaymentForwarded {
0 commit comments