@@ -318,11 +318,11 @@ const ERR: () = "You need at least 32 bit pointers (well, usize, but we'll assum
318
318
/// the "reorg path" (ie call block_disconnected() until you get to a common block and then call
319
319
/// block_connected() to step towards your best block) upon deserialization before using the
320
320
/// object!
321
- pub struct ChannelManager {
321
+ pub struct ChannelManager < ' a > {
322
322
default_configuration : UserConfig ,
323
323
genesis_hash : Sha256dHash ,
324
324
fee_estimator : Arc < FeeEstimator > ,
325
- monitor : Arc < ManyChannelMonitor > ,
325
+ monitor : Arc < ManyChannelMonitor + ' a > ,
326
326
tx_broadcaster : Arc < BroadcasterInterface > ,
327
327
328
328
#[ cfg( test) ]
@@ -575,7 +575,7 @@ macro_rules! maybe_break_monitor_err {
575
575
}
576
576
}
577
577
578
- impl ChannelManager {
578
+ impl < ' a > ChannelManager < ' a > {
579
579
/// Constructs a new ChannelManager to hold several channels and route between them.
580
580
///
581
581
/// This is the main "logic hub" for all channel-related actions, and implements
@@ -587,7 +587,7 @@ impl ChannelManager {
587
587
///
588
588
/// User must provide the current blockchain height from which to track onchain channel
589
589
/// funding outpoints and send payments with reliable timelocks.
590
- pub fn new ( network : Network , feeest : Arc < FeeEstimator > , monitor : Arc < ManyChannelMonitor > , chain_monitor : Arc < ChainWatchInterface > , tx_broadcaster : Arc < BroadcasterInterface > , logger : Arc < Logger > , keys_manager : Arc < KeysInterface > , config : UserConfig , current_blockchain_height : usize ) -> Result < Arc < ChannelManager > , secp256k1:: Error > {
590
+ pub fn new ( network : Network , feeest : Arc < FeeEstimator > , monitor : Arc < ManyChannelMonitor + ' a > , tx_broadcaster : Arc < BroadcasterInterface > , logger : Arc < Logger > , keys_manager : Arc < KeysInterface > , config : UserConfig , current_blockchain_height : usize ) -> Result < Arc < ChannelManager < ' a > > , secp256k1:: Error > {
591
591
let secp_ctx = Secp256k1 :: new ( ) ;
592
592
593
593
let res = Arc :: new ( ChannelManager {
@@ -2502,7 +2502,7 @@ impl ChannelManager {
2502
2502
}
2503
2503
}
2504
2504
2505
- impl events:: MessageSendEventsProvider for ChannelManager {
2505
+ impl < ' a > events:: MessageSendEventsProvider for ChannelManager < ' a > {
2506
2506
fn get_and_clear_pending_msg_events ( & self ) -> Vec < events:: MessageSendEvent > {
2507
2507
// TODO: Event release to users and serialization is currently race-y: it's very easy for a
2508
2508
// user to serialize a ChannelManager with pending events in it and lose those events on
@@ -2527,7 +2527,7 @@ impl events::MessageSendEventsProvider for ChannelManager {
2527
2527
}
2528
2528
}
2529
2529
2530
- impl events:: EventsProvider for ChannelManager {
2530
+ impl < ' a > events:: EventsProvider for ChannelManager < ' a > {
2531
2531
fn get_and_clear_pending_events ( & self ) -> Vec < events:: Event > {
2532
2532
// TODO: Event release to users and serialization is currently race-y: it's very easy for a
2533
2533
// user to serialize a ChannelManager with pending events in it and lose those events on
@@ -2552,7 +2552,7 @@ impl events::EventsProvider for ChannelManager {
2552
2552
}
2553
2553
}
2554
2554
2555
- impl ChainListener for ChannelManager {
2555
+ impl < ' a > ChainListener for ChannelManager < ' a > {
2556
2556
fn block_connected ( & self , header : & BlockHeader , height : u32 , txn_matched : & [ & Transaction ] , indexes_of_txn_matched : & [ u32 ] ) {
2557
2557
let header_hash = header. bitcoin_hash ( ) ;
2558
2558
log_trace ! ( self , "Block {} at height {} connected with {} txn matched" , header_hash, height, txn_matched. len( ) ) ;
@@ -2666,7 +2666,7 @@ impl ChainListener for ChannelManager {
2666
2666
}
2667
2667
}
2668
2668
2669
- impl ChannelMessageHandler for ChannelManager {
2669
+ impl < ' a > ChannelMessageHandler for ChannelManager < ' a > {
2670
2670
//TODO: Handle errors and close channel (or so)
2671
2671
fn handle_open_channel ( & self , their_node_id : & PublicKey , their_local_features : LocalFeatures , msg : & msgs:: OpenChannel ) -> Result < ( ) , LightningError > {
2672
2672
let _ = self . total_consistency_lock . read ( ) . unwrap ( ) ;
@@ -3051,7 +3051,7 @@ impl<R: ::std::io::Read> Readable<R> for HTLCForwardInfo {
3051
3051
}
3052
3052
}
3053
3053
3054
- impl Writeable for ChannelManager {
3054
+ impl < ' a > Writeable for ChannelManager < ' a > {
3055
3055
fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , :: std:: io:: Error > {
3056
3056
let _ = self . total_consistency_lock . write ( ) . unwrap ( ) ;
3057
3057
@@ -3115,7 +3115,7 @@ impl Writeable for ChannelManager {
3115
3115
/// 6) Disconnect/connect blocks on the ChannelManager.
3116
3116
/// 7) Register the new ChannelManager with your ChainWatchInterface (this does not happen
3117
3117
/// automatically as it does in ChannelManager::new()).
3118
- pub struct ChannelManagerReadArgs < ' a > {
3118
+ pub struct ChannelManagerReadArgs < ' a , ' b > {
3119
3119
/// The keys provider which will give us relevant keys. Some keys will be loaded during
3120
3120
/// deserialization.
3121
3121
pub keys_manager : Arc < KeysInterface > ,
@@ -3129,7 +3129,7 @@ pub struct ChannelManagerReadArgs<'a> {
3129
3129
/// No calls to the ManyChannelMonitor will be made during deserialization. It is assumed that
3130
3130
/// you have deserialized ChannelMonitors separately and will add them to your
3131
3131
/// ManyChannelMonitor after deserializing this ChannelManager.
3132
- pub monitor : Arc < ManyChannelMonitor > ,
3132
+ pub monitor : Arc < ManyChannelMonitor + ' b > ,
3133
3133
3134
3134
/// The BroadcasterInterface which will be used in the ChannelManager in the future and may be
3135
3135
/// used to broadcast the latest local commitment transactions of channels which must be
@@ -3155,8 +3155,8 @@ pub struct ChannelManagerReadArgs<'a> {
3155
3155
pub channel_monitors : & ' a HashMap < OutPoint , & ' a ChannelMonitor > ,
3156
3156
}
3157
3157
3158
- impl < ' a , R : :: std:: io:: Read > ReadableArgs < R , ChannelManagerReadArgs < ' a > > for ( Sha256dHash , ChannelManager ) {
3159
- fn read ( reader : & mut R , args : ChannelManagerReadArgs < ' a > ) -> Result < Self , DecodeError > {
3158
+ impl < ' a , ' b , R : :: std:: io:: Read > ReadableArgs < R , ChannelManagerReadArgs < ' a , ' b > > for ( Sha256dHash , ChannelManager < ' b > ) {
3159
+ fn read ( reader : & mut R , args : ChannelManagerReadArgs < ' a , ' b > ) -> Result < Self , DecodeError > {
3160
3160
let _ver: u8 = Readable :: read ( reader) ?;
3161
3161
let min_ver: u8 = Readable :: read ( reader) ?;
3162
3162
if min_ver > SERIALIZATION_VERSION {
0 commit comments