@@ -3411,8 +3411,13 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
34113411 // handling this case better and maybe fulfilling some of the HTLCs while attempting
34123412 // to rebalance channels.
34133413 match & htlc_update {
3414- & HTLCUpdateAwaitingACK :: AddHTLC { amount_msat, cltv_expiry, ref payment_hash, ref source, ref onion_routing_packet, ..} => {
3415- match self . send_htlc ( amount_msat, * payment_hash, cltv_expiry, source. clone ( ) , onion_routing_packet. clone ( ) , false , logger) {
3414+ & HTLCUpdateAwaitingACK :: AddHTLC {
3415+ amount_msat, cltv_expiry, ref payment_hash, ref source, ref onion_routing_packet,
3416+ skimmed_fee_msat, ..
3417+ } => {
3418+ match self . send_htlc ( amount_msat, * payment_hash, cltv_expiry, source. clone ( ) ,
3419+ onion_routing_packet. clone ( ) , false , skimmed_fee_msat, logger)
3420+ {
34163421 Ok ( update_add_msg_option) => update_add_htlcs. push ( update_add_msg_option. unwrap ( ) ) ,
34173422 Err ( e) => {
34183423 match e {
@@ -4054,7 +4059,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
40544059 payment_hash : htlc. payment_hash ,
40554060 cltv_expiry : htlc. cltv_expiry ,
40564061 onion_routing_packet : ( * * onion_packet) . clone ( ) ,
4057- skimmed_fee_msat : None ,
4062+ skimmed_fee_msat : htlc . skimmed_fee_msat ,
40584063 } ) ;
40594064 }
40604065 }
@@ -5868,11 +5873,13 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
58685873 /// commitment update.
58695874 ///
58705875 /// `Err`s will only be [`ChannelError::Ignore`].
5871- pub fn queue_add_htlc < L : Deref > ( & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
5872- onion_routing_packet : msgs:: OnionPacket , logger : & L )
5873- -> Result < ( ) , ChannelError > where L :: Target : Logger {
5876+ pub fn queue_add_htlc < L : Deref > (
5877+ & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
5878+ onion_routing_packet : msgs:: OnionPacket , skimmed_fee_msat : Option < u64 > , logger : & L
5879+ ) -> Result < ( ) , ChannelError > where L :: Target : Logger {
58745880 self
5875- . send_htlc ( amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, true , logger)
5881+ . send_htlc ( amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, true ,
5882+ skimmed_fee_msat, logger)
58765883 . map ( |msg_opt| assert ! ( msg_opt. is_none( ) , "We forced holding cell?" ) )
58775884 . map_err ( |err| {
58785885 if let ChannelError :: Ignore ( _) = err { /* fine */ }
@@ -5897,9 +5904,11 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
58975904 /// on this [`Channel`] if `force_holding_cell` is false.
58985905 ///
58995906 /// `Err`s will only be [`ChannelError::Ignore`].
5900- fn send_htlc < L : Deref > ( & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
5901- onion_routing_packet : msgs:: OnionPacket , mut force_holding_cell : bool , logger : & L )
5902- -> Result < Option < msgs:: UpdateAddHTLC > , ChannelError > where L :: Target : Logger {
5907+ fn send_htlc < L : Deref > (
5908+ & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
5909+ onion_routing_packet : msgs:: OnionPacket , mut force_holding_cell : bool ,
5910+ skimmed_fee_msat : Option < u64 > , logger : & L
5911+ ) -> Result < Option < msgs:: UpdateAddHTLC > , ChannelError > where L :: Target : Logger {
59035912 if ( self . channel_state & ( ChannelState :: ChannelReady as u32 | BOTH_SIDES_SHUTDOWN_MASK ) ) != ( ChannelState :: ChannelReady as u32 ) {
59045913 return Err ( ChannelError :: Ignore ( "Cannot send HTLC until channel is fully established and we haven't started shutting down" . to_owned ( ) ) ) ;
59055914 }
@@ -6006,7 +6015,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
60066015 cltv_expiry,
60076016 source,
60086017 onion_routing_packet,
6009- skimmed_fee_msat : None ,
6018+ skimmed_fee_msat,
60106019 } ) ;
60116020 return Ok ( None ) ;
60126021 }
@@ -6018,7 +6027,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
60186027 cltv_expiry,
60196028 state : OutboundHTLCState :: LocalAnnounced ( Box :: new ( onion_routing_packet. clone ( ) ) ) ,
60206029 source,
6021- skimmed_fee_msat : None ,
6030+ skimmed_fee_msat,
60226031 } ) ;
60236032
60246033 let res = msgs:: UpdateAddHTLC {
@@ -6028,7 +6037,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
60286037 payment_hash,
60296038 cltv_expiry,
60306039 onion_routing_packet,
6031- skimmed_fee_msat : None ,
6040+ skimmed_fee_msat,
60326041 } ;
60336042 self . next_holder_htlc_id += 1 ;
60346043
@@ -6167,8 +6176,12 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
61676176 ///
61686177 /// Shorthand for calling [`Self::send_htlc`] followed by a commitment update, see docs on
61696178 /// [`Self::send_htlc`] and [`Self::build_commitment_no_state_update`] for more info.
6170- pub fn send_htlc_and_commit < L : Deref > ( & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource , onion_routing_packet : msgs:: OnionPacket , logger : & L ) -> Result < Option < & ChannelMonitorUpdate > , ChannelError > where L :: Target : Logger {
6171- let send_res = self . send_htlc ( amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, false , logger) ;
6179+ pub fn send_htlc_and_commit < L : Deref > (
6180+ & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
6181+ onion_routing_packet : msgs:: OnionPacket , skimmed_fee_msat : Option < u64 > , logger : & L
6182+ ) -> Result < Option < & ChannelMonitorUpdate > , ChannelError > where L :: Target : Logger {
6183+ let send_res = self . send_htlc ( amount_msat, payment_hash, cltv_expiry, source,
6184+ onion_routing_packet, false , skimmed_fee_msat, logger) ;
61726185 if let Err ( e) = & send_res { if let ChannelError :: Ignore ( _) = e { } else { debug_assert ! ( false , "Sending cannot trigger channel failure" ) ; } }
61736186 match send_res? {
61746187 Some ( _) => {
0 commit comments