@@ -40,7 +40,7 @@ use crate::events::{Event, EventHandler, EventsProvider, MessageSendEvent, Messa
40
40
// Since this struct is returned in `list_channels` methods, expose it here in case users want to
41
41
// construct one themselves.
42
42
use crate :: ln:: { inbound_payment, PaymentHash , PaymentPreimage , PaymentSecret } ;
43
- use crate :: ln:: channel:: { Channel , ChannelError , ChannelUpdateStatus , ShutdownResult , UpdateFulfillCommitFetch } ;
43
+ use crate :: ln:: channel:: { Channel , ChannelContext , ChannelError , ChannelUpdateStatus , ShutdownResult , UpdateFulfillCommitFetch } ;
44
44
use crate :: ln:: features:: { ChannelFeatures , ChannelTypeFeatures , InitFeatures , NodeFeatures } ;
45
45
#[ cfg( any( feature = "_test_utils" , test) ) ]
46
46
use crate :: ln:: features:: InvoiceFeatures ;
@@ -2166,19 +2166,19 @@ where
2166
2166
}
2167
2167
2168
2168
/// Helper function that issues the channel close events
2169
- fn issue_channel_close_events ( & self , channel : & Channel < <SP :: Target as SignerProvider >:: Signer > , closure_reason : ClosureReason ) {
2169
+ fn issue_channel_close_events ( & self , context : & ChannelContext < <SP :: Target as SignerProvider >:: Signer > , closure_reason : ClosureReason ) {
2170
2170
let mut pending_events_lock = self . pending_events . lock ( ) . unwrap ( ) ;
2171
- match channel . unbroadcasted_funding ( ) {
2171
+ match context . unbroadcasted_funding ( ) {
2172
2172
Some ( transaction) => {
2173
2173
pending_events_lock. push_back ( ( events:: Event :: DiscardFunding {
2174
- channel_id : channel . context . channel_id ( ) , transaction
2174
+ channel_id : context. channel_id ( ) , transaction
2175
2175
} , None ) ) ;
2176
2176
} ,
2177
2177
None => { } ,
2178
2178
}
2179
2179
pending_events_lock. push_back ( ( events:: Event :: ChannelClosed {
2180
- channel_id : channel . context . channel_id ( ) ,
2181
- user_channel_id : channel . context . get_user_id ( ) ,
2180
+ channel_id : context. channel_id ( ) ,
2181
+ user_channel_id : context. get_user_id ( ) ,
2182
2182
reason : closure_reason
2183
2183
} , None ) ) ;
2184
2184
}
@@ -2225,7 +2225,7 @@ where
2225
2225
msg : channel_update
2226
2226
} ) ;
2227
2227
}
2228
- self . issue_channel_close_events ( & channel, ClosureReason :: HolderForceClosed ) ;
2228
+ self . issue_channel_close_events ( & channel. context , ClosureReason :: HolderForceClosed ) ;
2229
2229
}
2230
2230
break Ok ( ( ) ) ;
2231
2231
} ,
@@ -2335,9 +2335,9 @@ where
2335
2335
let peer_state = & mut * peer_state_lock;
2336
2336
if let hash_map:: Entry :: Occupied ( chan) = peer_state. channel_by_id . entry ( channel_id. clone ( ) ) {
2337
2337
if let Some ( peer_msg) = peer_msg {
2338
- self . issue_channel_close_events ( chan. get ( ) , ClosureReason :: CounterpartyForceClosed { peer_msg : UntrustedString ( peer_msg. to_string ( ) ) } ) ;
2338
+ self . issue_channel_close_events ( & chan. get ( ) . context , ClosureReason :: CounterpartyForceClosed { peer_msg : UntrustedString ( peer_msg. to_string ( ) ) } ) ;
2339
2339
} else {
2340
- self . issue_channel_close_events ( chan. get ( ) , ClosureReason :: HolderForceClosed ) ;
2340
+ self . issue_channel_close_events ( & chan. get ( ) . context , ClosureReason :: HolderForceClosed ) ;
2341
2341
}
2342
2342
remove_channel ! ( self , chan)
2343
2343
} else {
@@ -5212,7 +5212,7 @@ where
5212
5212
msg : update
5213
5213
} ) ;
5214
5214
}
5215
- self . issue_channel_close_events ( & chan, ClosureReason :: CooperativeClosure ) ;
5215
+ self . issue_channel_close_events ( & chan. context , ClosureReason :: CooperativeClosure ) ;
5216
5216
}
5217
5217
Ok ( ( ) )
5218
5218
}
@@ -5697,7 +5697,7 @@ where
5697
5697
} else {
5698
5698
ClosureReason :: CommitmentTxConfirmed
5699
5699
} ;
5700
- self . issue_channel_close_events ( & chan, reason) ;
5700
+ self . issue_channel_close_events ( & chan. context , reason) ;
5701
5701
pending_msg_events. push ( events:: MessageSendEvent :: HandleError {
5702
5702
node_id : chan. context . get_counterparty_node_id ( ) ,
5703
5703
action : msgs:: ErrorAction :: SendErrorMessage {
@@ -5822,7 +5822,7 @@ where
5822
5822
} ) ;
5823
5823
}
5824
5824
5825
- self . issue_channel_close_events ( chan, ClosureReason :: CooperativeClosure ) ;
5825
+ self . issue_channel_close_events ( & chan. context , ClosureReason :: CooperativeClosure ) ;
5826
5826
5827
5827
log_info ! ( self . logger, "Broadcasting {}" , log_tx!( tx) ) ;
5828
5828
self . tx_broadcaster . broadcast_transactions ( & [ & tx] ) ;
@@ -6540,7 +6540,7 @@ where
6540
6540
} ) ;
6541
6541
}
6542
6542
let reason_message = format ! ( "{}" , reason) ;
6543
- self . issue_channel_close_events ( channel, reason) ;
6543
+ self . issue_channel_close_events ( & channel. context , reason) ;
6544
6544
pending_msg_events. push ( events:: MessageSendEvent :: HandleError {
6545
6545
node_id : channel. context . get_counterparty_node_id ( ) ,
6546
6546
action : msgs:: ErrorAction :: SendErrorMessage { msg : msgs:: ErrorMessage {
@@ -6791,7 +6791,7 @@ where
6791
6791
chan. remove_uncommitted_htlcs_and_mark_paused ( & self . logger ) ;
6792
6792
if chan. is_shutdown ( ) {
6793
6793
update_maps_on_chan_removal ! ( self , chan) ;
6794
- self . issue_channel_close_events ( chan, ClosureReason :: DisconnectedPeer ) ;
6794
+ self . issue_channel_close_events ( & chan. context , ClosureReason :: DisconnectedPeer ) ;
6795
6795
return false ;
6796
6796
}
6797
6797
true
0 commit comments