@@ -2971,23 +2971,29 @@ impl<ChanSigner: ChannelKeys, M: Deref + Sync + Send, T: Deref + Sync + Send, K:
2971
2971
let short_to_id = & mut channel_state. short_to_id ;
2972
2972
let pending_msg_events = & mut channel_state. pending_msg_events ;
2973
2973
channel_state. by_id . retain ( |_, channel| {
2974
- let chan_res = channel. block_connected ( header, height, txn_matched, indexes_of_txn_matched) ;
2975
- if let Ok ( Some ( funding_locked) ) = chan_res {
2976
- pending_msg_events. push ( events:: MessageSendEvent :: SendFundingLocked {
2977
- node_id : channel. get_their_node_id ( ) ,
2978
- msg : funding_locked,
2979
- } ) ;
2980
- if let Some ( announcement_sigs) = self . get_announcement_sigs ( channel) {
2981
- log_trace ! ( self , "Sending funding_locked and announcement_signatures for {}" , log_bytes!( channel. channel_id( ) ) ) ;
2982
- pending_msg_events. push ( events:: MessageSendEvent :: SendAnnouncementSignatures {
2974
+ let res = channel. block_connected ( header, height, txn_matched, indexes_of_txn_matched) ;
2975
+ if let Ok ( ( chan_res, mut timed_out_pending_htlcs) ) = res {
2976
+ timed_out_htlcs. reserve ( timed_out_pending_htlcs. len ( ) ) ;
2977
+ for ( htlc_src, payment_hash, value) in timed_out_pending_htlcs. drain ( ..) {
2978
+ timed_out_htlcs. push ( ( htlc_src, payment_hash, value) ) ;
2979
+ }
2980
+ if let Some ( funding_locked) = chan_res {
2981
+ pending_msg_events. push ( events:: MessageSendEvent :: SendFundingLocked {
2983
2982
node_id : channel. get_their_node_id ( ) ,
2984
- msg : announcement_sigs ,
2983
+ msg : funding_locked ,
2985
2984
} ) ;
2986
- } else {
2987
- log_trace ! ( self , "Sending funding_locked WITHOUT announcement_signatures for {}" , log_bytes!( channel. channel_id( ) ) ) ;
2985
+ if let Some ( announcement_sigs) = self . get_announcement_sigs ( channel) {
2986
+ log_trace ! ( self , "Sending funding_locked and announcement_signatures for {}" , log_bytes!( channel. channel_id( ) ) ) ;
2987
+ pending_msg_events. push ( events:: MessageSendEvent :: SendAnnouncementSignatures {
2988
+ node_id : channel. get_their_node_id ( ) ,
2989
+ msg : announcement_sigs,
2990
+ } ) ;
2991
+ } else {
2992
+ log_trace ! ( self , "Sending funding_locked WITHOUT announcement_signatures for {}" , log_bytes!( channel. channel_id( ) ) ) ;
2993
+ }
2994
+ short_to_id. insert ( channel. get_short_channel_id ( ) . unwrap ( ) , channel. channel_id ( ) ) ;
2988
2995
}
2989
- short_to_id. insert ( channel. get_short_channel_id ( ) . unwrap ( ) , channel. channel_id ( ) ) ;
2990
- } else if let Err ( e) = chan_res {
2996
+ } else if let Err ( e) = res {
2991
2997
pending_msg_events. push ( events:: MessageSendEvent :: HandleError {
2992
2998
node_id : channel. get_their_node_id ( ) ,
2993
2999
action : msgs:: ErrorAction :: SendErrorMessage { msg : e } ,
0 commit comments