@@ -3526,8 +3526,13 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3526
3526
// handling this case better and maybe fulfilling some of the HTLCs while attempting
3527
3527
// to rebalance channels.
3528
3528
match & htlc_update {
3529
- & HTLCUpdateAwaitingACK :: AddHTLC { amount_msat, cltv_expiry, ref payment_hash, ref source, ref onion_routing_packet, ..} => {
3530
- match self . send_htlc ( amount_msat, * payment_hash, cltv_expiry, source. clone ( ) , onion_routing_packet. clone ( ) , false , logger) {
3529
+ & HTLCUpdateAwaitingACK :: AddHTLC {
3530
+ amount_msat, cltv_expiry, ref payment_hash, ref source, ref onion_routing_packet,
3531
+ skimmed_fee_msat, ..
3532
+ } => {
3533
+ match self . send_htlc ( amount_msat, * payment_hash, cltv_expiry, source. clone ( ) ,
3534
+ onion_routing_packet. clone ( ) , false , skimmed_fee_msat, logger)
3535
+ {
3531
3536
Ok ( update_add_msg_option) => update_add_htlcs. push ( update_add_msg_option. unwrap ( ) ) ,
3532
3537
Err ( e) => {
3533
3538
match e {
@@ -4169,7 +4174,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
4169
4174
payment_hash : htlc. payment_hash ,
4170
4175
cltv_expiry : htlc. cltv_expiry ,
4171
4176
onion_routing_packet : ( * * onion_packet) . clone ( ) ,
4172
- skimmed_fee_msat : None ,
4177
+ skimmed_fee_msat : htlc . skimmed_fee_msat ,
4173
4178
} ) ;
4174
4179
}
4175
4180
}
@@ -5983,11 +5988,13 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5983
5988
/// commitment update.
5984
5989
///
5985
5990
/// `Err`s will only be [`ChannelError::Ignore`].
5986
- pub fn queue_add_htlc < L : Deref > ( & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
5987
- onion_routing_packet : msgs:: OnionPacket , logger : & L )
5988
- -> Result < ( ) , ChannelError > where L :: Target : Logger {
5991
+ pub fn queue_add_htlc < L : Deref > (
5992
+ & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
5993
+ onion_routing_packet : msgs:: OnionPacket , skimmed_fee_msat : Option < u64 > , logger : & L
5994
+ ) -> Result < ( ) , ChannelError > where L :: Target : Logger {
5989
5995
self
5990
- . send_htlc ( amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, true , logger)
5996
+ . send_htlc ( amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, true ,
5997
+ skimmed_fee_msat, logger)
5991
5998
. map ( |msg_opt| assert ! ( msg_opt. is_none( ) , "We forced holding cell?" ) )
5992
5999
. map_err ( |err| {
5993
6000
if let ChannelError :: Ignore ( _) = err { /* fine */ }
@@ -6012,9 +6019,11 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
6012
6019
/// on this [`Channel`] if `force_holding_cell` is false.
6013
6020
///
6014
6021
/// `Err`s will only be [`ChannelError::Ignore`].
6015
- fn send_htlc < L : Deref > ( & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
6016
- onion_routing_packet : msgs:: OnionPacket , mut force_holding_cell : bool , logger : & L )
6017
- -> Result < Option < msgs:: UpdateAddHTLC > , ChannelError > where L :: Target : Logger {
6022
+ fn send_htlc < L : Deref > (
6023
+ & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
6024
+ onion_routing_packet : msgs:: OnionPacket , mut force_holding_cell : bool ,
6025
+ skimmed_fee_msat : Option < u64 > , logger : & L
6026
+ ) -> Result < Option < msgs:: UpdateAddHTLC > , ChannelError > where L :: Target : Logger {
6018
6027
if ( self . channel_state & ( ChannelState :: ChannelReady as u32 | BOTH_SIDES_SHUTDOWN_MASK ) ) != ( ChannelState :: ChannelReady as u32 ) {
6019
6028
return Err ( ChannelError :: Ignore ( "Cannot send HTLC until channel is fully established and we haven't started shutting down" . to_owned ( ) ) ) ;
6020
6029
}
@@ -6066,7 +6075,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
6066
6075
cltv_expiry,
6067
6076
source,
6068
6077
onion_routing_packet,
6069
- skimmed_fee_msat : None ,
6078
+ skimmed_fee_msat,
6070
6079
} ) ;
6071
6080
return Ok ( None ) ;
6072
6081
}
@@ -6078,7 +6087,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
6078
6087
cltv_expiry,
6079
6088
state : OutboundHTLCState :: LocalAnnounced ( Box :: new ( onion_routing_packet. clone ( ) ) ) ,
6080
6089
source,
6081
- skimmed_fee_msat : None ,
6090
+ skimmed_fee_msat,
6082
6091
} ) ;
6083
6092
6084
6093
let res = msgs:: UpdateAddHTLC {
@@ -6088,7 +6097,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
6088
6097
payment_hash,
6089
6098
cltv_expiry,
6090
6099
onion_routing_packet,
6091
- skimmed_fee_msat : None ,
6100
+ skimmed_fee_msat,
6092
6101
} ;
6093
6102
self . next_holder_htlc_id += 1 ;
6094
6103
@@ -6227,8 +6236,12 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
6227
6236
///
6228
6237
/// Shorthand for calling [`Self::send_htlc`] followed by a commitment update, see docs on
6229
6238
/// [`Self::send_htlc`] and [`Self::build_commitment_no_state_update`] for more info.
6230
- 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 {
6231
- let send_res = self . send_htlc ( amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, false , logger) ;
6239
+ pub fn send_htlc_and_commit < L : Deref > (
6240
+ & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
6241
+ onion_routing_packet : msgs:: OnionPacket , skimmed_fee_msat : Option < u64 > , logger : & L
6242
+ ) -> Result < Option < & ChannelMonitorUpdate > , ChannelError > where L :: Target : Logger {
6243
+ let send_res = self . send_htlc ( amount_msat, payment_hash, cltv_expiry, source,
6244
+ onion_routing_packet, false , skimmed_fee_msat, logger) ;
6232
6245
if let Err ( e) = & send_res { if let ChannelError :: Ignore ( _) = e { } else { debug_assert ! ( false , "Sending cannot trigger channel failure" ) ; } }
6233
6246
match send_res? {
6234
6247
Some ( _) => {
0 commit comments