@@ -3620,7 +3620,10 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
3620
3620
// Fail a list of HTLCs that were just freed from the holding cell. The HTLCs need to be
3621
3621
// failed backwards or, if they were one of our outgoing HTLCs, then their failure needs to
3622
3622
// be surfaced to the user.
3623
- fn fail_holding_cell_htlcs ( & self , mut htlcs_to_fail : Vec < ( HTLCSource , PaymentHash ) > , channel_id : [ u8 ; 32 ] ) {
3623
+ fn fail_holding_cell_htlcs (
3624
+ & self , mut htlcs_to_fail : Vec < ( HTLCSource , PaymentHash ) > , channel_id : [ u8 ; 32 ] ,
3625
+ _counterparty_node_id : & PublicKey
3626
+ ) {
3624
3627
for ( htlc_src, payment_hash) in htlcs_to_fail. drain ( ..) {
3625
3628
match htlc_src {
3626
3629
HTLCSource :: PreviousHopData ( HTLCPreviousHopData { .. } ) => {
@@ -4828,7 +4831,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4828
4831
hash_map:: Entry :: Vacant ( _) => break Err ( MsgHandleErrInternal :: send_err_msg_no_close ( "Failed to find corresponding channel" . to_owned ( ) , msg. channel_id ) )
4829
4832
}
4830
4833
} ;
4831
- self . fail_holding_cell_htlcs ( htlcs_to_fail, msg. channel_id ) ;
4834
+ self . fail_holding_cell_htlcs ( htlcs_to_fail, msg. channel_id , counterparty_node_id ) ;
4832
4835
match res {
4833
4836
Ok ( ( pending_forwards, mut pending_failures, finalized_claim_htlcs,
4834
4837
short_channel_id, channel_outpoint) ) =>
@@ -4968,7 +4971,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4968
4971
}
4969
4972
} ;
4970
4973
post_handle_chan_restoration ! ( self , chan_restoration_res) ;
4971
- self . fail_holding_cell_htlcs ( htlcs_failed_forward, msg. channel_id ) ;
4974
+ self . fail_holding_cell_htlcs ( htlcs_failed_forward, msg. channel_id , counterparty_node_id ) ;
4972
4975
4973
4976
if let Some ( channel_ready_msg) = need_lnd_workaround {
4974
4977
self . internal_channel_ready ( counterparty_node_id, & channel_ready_msg) ?;
@@ -5066,7 +5069,11 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
5066
5069
match chan. maybe_free_holding_cell_htlcs ( & self . logger ) {
5067
5070
Ok ( ( commitment_opt, holding_cell_failed_htlcs) ) => {
5068
5071
if !holding_cell_failed_htlcs. is_empty ( ) {
5069
- failed_htlcs. push ( ( holding_cell_failed_htlcs, * channel_id) ) ;
5072
+ failed_htlcs. push ( (
5073
+ holding_cell_failed_htlcs,
5074
+ * channel_id,
5075
+ chan. get_counterparty_node_id ( )
5076
+ ) ) ;
5070
5077
}
5071
5078
if let Some ( ( commitment_update, monitor_update) ) = commitment_opt {
5072
5079
if let Err ( e) = self . chain_monitor . update_channel ( chan. get_funding_txo ( ) . unwrap ( ) , monitor_update) {
@@ -5094,8 +5101,8 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
5094
5101
}
5095
5102
5096
5103
let has_update = has_monitor_update || !failed_htlcs. is_empty ( ) || !handle_errors. is_empty ( ) ;
5097
- for ( failures, channel_id) in failed_htlcs. drain ( ..) {
5098
- self . fail_holding_cell_htlcs ( failures, channel_id) ;
5104
+ for ( failures, channel_id, counterparty_node_id ) in failed_htlcs. drain ( ..) {
5105
+ self . fail_holding_cell_htlcs ( failures, channel_id, & counterparty_node_id ) ;
5099
5106
}
5100
5107
5101
5108
for ( counterparty_node_id, err) in handle_errors. drain ( ..) {
0 commit comments