@@ -3411,8 +3411,13 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3411
3411
// handling this case better and maybe fulfilling some of the HTLCs while attempting
3412
3412
// to rebalance channels.
3413
3413
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
+ {
3416
3421
Ok ( update_add_msg_option) => update_add_htlcs. push ( update_add_msg_option. unwrap ( ) ) ,
3417
3422
Err ( e) => {
3418
3423
match e {
@@ -4054,7 +4059,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
4054
4059
payment_hash : htlc. payment_hash ,
4055
4060
cltv_expiry : htlc. cltv_expiry ,
4056
4061
onion_routing_packet : ( * * onion_packet) . clone ( ) ,
4057
- skimmed_fee_msat : None ,
4062
+ skimmed_fee_msat : htlc . skimmed_fee_msat ,
4058
4063
} ) ;
4059
4064
}
4060
4065
}
@@ -5868,11 +5873,13 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5868
5873
/// commitment update.
5869
5874
///
5870
5875
/// `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 {
5874
5880
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)
5876
5883
. map ( |msg_opt| assert ! ( msg_opt. is_none( ) , "We forced holding cell?" ) )
5877
5884
. map_err ( |err| {
5878
5885
if let ChannelError :: Ignore ( _) = err { /* fine */ }
@@ -5897,9 +5904,11 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5897
5904
/// on this [`Channel`] if `force_holding_cell` is false.
5898
5905
///
5899
5906
/// `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 {
5903
5912
if ( self . channel_state & ( ChannelState :: ChannelReady as u32 | BOTH_SIDES_SHUTDOWN_MASK ) ) != ( ChannelState :: ChannelReady as u32 ) {
5904
5913
return Err ( ChannelError :: Ignore ( "Cannot send HTLC until channel is fully established and we haven't started shutting down" . to_owned ( ) ) ) ;
5905
5914
}
@@ -6006,7 +6015,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
6006
6015
cltv_expiry,
6007
6016
source,
6008
6017
onion_routing_packet,
6009
- skimmed_fee_msat : None ,
6018
+ skimmed_fee_msat,
6010
6019
} ) ;
6011
6020
return Ok ( None ) ;
6012
6021
}
@@ -6018,7 +6027,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
6018
6027
cltv_expiry,
6019
6028
state : OutboundHTLCState :: LocalAnnounced ( Box :: new ( onion_routing_packet. clone ( ) ) ) ,
6020
6029
source,
6021
- skimmed_fee_msat : None ,
6030
+ skimmed_fee_msat,
6022
6031
} ) ;
6023
6032
6024
6033
let res = msgs:: UpdateAddHTLC {
@@ -6028,7 +6037,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
6028
6037
payment_hash,
6029
6038
cltv_expiry,
6030
6039
onion_routing_packet,
6031
- skimmed_fee_msat : None ,
6040
+ skimmed_fee_msat,
6032
6041
} ;
6033
6042
self . next_holder_htlc_id += 1 ;
6034
6043
@@ -6167,8 +6176,12 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
6167
6176
///
6168
6177
/// Shorthand for calling [`Self::send_htlc`] followed by a commitment update, see docs on
6169
6178
/// [`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) ;
6172
6185
if let Err ( e) = & send_res { if let ChannelError :: Ignore ( _) = e { } else { debug_assert ! ( false , "Sending cannot trigger channel failure" ) ; } }
6173
6186
match send_res? {
6174
6187
Some ( _) => {
0 commit comments