@@ -3383,8 +3383,13 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
3383
3383
// handling this case better and maybe fulfilling some of the HTLCs while attempting
3384
3384
// to rebalance channels.
3385
3385
match & htlc_update {
3386
- & HTLCUpdateAwaitingACK :: AddHTLC { amount_msat, cltv_expiry, ref payment_hash, ref source, ref onion_routing_packet, ..} => {
3387
- match self . send_htlc ( amount_msat, * payment_hash, cltv_expiry, source. clone ( ) , onion_routing_packet. clone ( ) , false , logger) {
3386
+ & HTLCUpdateAwaitingACK :: AddHTLC {
3387
+ amount_msat, cltv_expiry, ref payment_hash, ref source, ref onion_routing_packet,
3388
+ skimmed_fee_msat, ..
3389
+ } => {
3390
+ match self . send_htlc ( amount_msat, * payment_hash, cltv_expiry, source. clone ( ) ,
3391
+ onion_routing_packet. clone ( ) , false , skimmed_fee_msat, logger)
3392
+ {
3388
3393
Ok ( update_add_msg_option) => update_add_htlcs. push ( update_add_msg_option. unwrap ( ) ) ,
3389
3394
Err ( e) => {
3390
3395
match e {
@@ -4022,7 +4027,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
4022
4027
payment_hash : htlc. payment_hash ,
4023
4028
cltv_expiry : htlc. cltv_expiry ,
4024
4029
onion_routing_packet : ( * * onion_packet) . clone ( ) ,
4025
- skimmed_fee_msat : None ,
4030
+ skimmed_fee_msat : htlc . skimmed_fee_msat ,
4026
4031
} ) ;
4027
4032
}
4028
4033
}
@@ -5793,11 +5798,13 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5793
5798
/// commitment update.
5794
5799
///
5795
5800
/// `Err`s will only be [`ChannelError::Ignore`].
5796
- pub fn queue_add_htlc < L : Deref > ( & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
5797
- onion_routing_packet : msgs:: OnionPacket , logger : & L )
5798
- -> Result < ( ) , ChannelError > where L :: Target : Logger {
5801
+ pub fn queue_add_htlc < L : Deref > (
5802
+ & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
5803
+ onion_routing_packet : msgs:: OnionPacket , skimmed_fee_msat : Option < u64 > , logger : & L
5804
+ ) -> Result < ( ) , ChannelError > where L :: Target : Logger {
5799
5805
self
5800
- . send_htlc ( amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, true , logger)
5806
+ . send_htlc ( amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, true ,
5807
+ skimmed_fee_msat, logger)
5801
5808
. map ( |msg_opt| assert ! ( msg_opt. is_none( ) , "We forced holding cell?" ) )
5802
5809
. map_err ( |err| {
5803
5810
if let ChannelError :: Ignore ( _) = err { /* fine */ }
@@ -5822,9 +5829,11 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5822
5829
/// on this [`Channel`] if `force_holding_cell` is false.
5823
5830
///
5824
5831
/// `Err`s will only be [`ChannelError::Ignore`].
5825
- fn send_htlc < L : Deref > ( & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
5826
- onion_routing_packet : msgs:: OnionPacket , mut force_holding_cell : bool , logger : & L )
5827
- -> Result < Option < msgs:: UpdateAddHTLC > , ChannelError > where L :: Target : Logger {
5832
+ fn send_htlc < L : Deref > (
5833
+ & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
5834
+ onion_routing_packet : msgs:: OnionPacket , mut force_holding_cell : bool ,
5835
+ skimmed_fee_msat : Option < u64 > , logger : & L
5836
+ ) -> Result < Option < msgs:: UpdateAddHTLC > , ChannelError > where L :: Target : Logger {
5828
5837
if ( self . channel_state & ( ChannelState :: ChannelReady as u32 | BOTH_SIDES_SHUTDOWN_MASK ) ) != ( ChannelState :: ChannelReady as u32 ) {
5829
5838
return Err ( ChannelError :: Ignore ( "Cannot send HTLC until channel is fully established and we haven't started shutting down" . to_owned ( ) ) ) ;
5830
5839
}
@@ -5931,7 +5940,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5931
5940
cltv_expiry,
5932
5941
source,
5933
5942
onion_routing_packet,
5934
- skimmed_fee_msat : None ,
5943
+ skimmed_fee_msat,
5935
5944
} ) ;
5936
5945
return Ok ( None ) ;
5937
5946
}
@@ -5943,7 +5952,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5943
5952
cltv_expiry,
5944
5953
state : OutboundHTLCState :: LocalAnnounced ( Box :: new ( onion_routing_packet. clone ( ) ) ) ,
5945
5954
source,
5946
- skimmed_fee_msat : None ,
5955
+ skimmed_fee_msat,
5947
5956
} ) ;
5948
5957
5949
5958
let res = msgs:: UpdateAddHTLC {
@@ -5953,7 +5962,7 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
5953
5962
payment_hash,
5954
5963
cltv_expiry,
5955
5964
onion_routing_packet,
5956
- skimmed_fee_msat : None ,
5965
+ skimmed_fee_msat,
5957
5966
} ;
5958
5967
self . next_holder_htlc_id += 1 ;
5959
5968
@@ -6092,8 +6101,12 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
6092
6101
///
6093
6102
/// Shorthand for calling [`Self::send_htlc`] followed by a commitment update, see docs on
6094
6103
/// [`Self::send_htlc`] and [`Self::build_commitment_no_state_update`] for more info.
6095
- 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 {
6096
- let send_res = self . send_htlc ( amount_msat, payment_hash, cltv_expiry, source, onion_routing_packet, false , logger) ;
6104
+ pub fn send_htlc_and_commit < L : Deref > (
6105
+ & mut self , amount_msat : u64 , payment_hash : PaymentHash , cltv_expiry : u32 , source : HTLCSource ,
6106
+ onion_routing_packet : msgs:: OnionPacket , skimmed_fee_msat : Option < u64 > , logger : & L
6107
+ ) -> Result < Option < & ChannelMonitorUpdate > , ChannelError > where L :: Target : Logger {
6108
+ let send_res = self . send_htlc ( amount_msat, payment_hash, cltv_expiry, source,
6109
+ onion_routing_packet, false , skimmed_fee_msat, logger) ;
6097
6110
if let Err ( e) = & send_res { if let ChannelError :: Ignore ( _) = e { } else { debug_assert ! ( false , "Sending cannot trigger channel failure" ) ; } }
6098
6111
match send_res? {
6099
6112
Some ( _) => {
0 commit comments