@@ -9,10 +9,7 @@ use bitcoin::blockdata::constants::ChainHash;
99use bitcoin:: blockdata:: transaction:: { TxOut , OutPoint } ;
1010use bitcoin:: hash_types:: BlockHash ;
1111
12- use lightning:: sign:: NodeSigner ;
13-
14- use lightning:: ln:: peer_handler:: { CustomMessageHandler , PeerManager , SocketDescriptor } ;
15- use lightning:: ln:: msgs:: { ChannelMessageHandler , OnionMessageHandler } ;
12+ use lightning:: ln:: peer_handler:: APeerManager ;
1613
1714use lightning:: routing:: gossip:: { NetworkGraph , P2PGossipSync } ;
1815use lightning:: routing:: utxo:: { UtxoFuture , UtxoLookup , UtxoResult , UtxoLookupError } ;
@@ -135,21 +132,14 @@ impl<
135132pub struct GossipVerifier < S : FutureSpawner ,
136133 Blocks : Deref + Send + Sync + ' static + Clone ,
137134 L : Deref + Send + Sync + ' static ,
138- Descriptor : SocketDescriptor + Send + Sync + ' static ,
139- CM : Deref + Send + Sync + ' static ,
140- OM : Deref + Send + Sync + ' static ,
141- CMH : Deref + Send + Sync + ' static ,
142- NS : Deref + Send + Sync + ' static ,
135+ APM : Deref + Send + Sync + ' static + Clone ,
143136> where
144137 Blocks :: Target : UtxoSource ,
145138 L :: Target : Logger ,
146- CM :: Target : ChannelMessageHandler ,
147- OM :: Target : OnionMessageHandler ,
148- CMH :: Target : CustomMessageHandler ,
149- NS :: Target : NodeSigner ,
139+ APM :: Target : APeerManager ,
150140{
151141 source : Blocks ,
152- peer_manager : Arc < PeerManager < Descriptor , CM , Arc < P2PGossipSync < Arc < NetworkGraph < L > > , Self , L > > , OM , L , CMH , NS > > ,
142+ peer_manager : APM ,
153143 gossiper : Arc < P2PGossipSync < Arc < NetworkGraph < L > > , Self , L > > ,
154144 spawn : S ,
155145 block_cache : Arc < Mutex < VecDeque < ( u32 , Block ) > > > ,
@@ -160,24 +150,17 @@ const BLOCK_CACHE_SIZE: usize = 5;
160150impl < S : FutureSpawner ,
161151 Blocks : Deref + Send + Sync + Clone ,
162152 L : Deref + Send + Sync ,
163- Descriptor : SocketDescriptor + Send + Sync ,
164- CM : Deref + Send + Sync ,
165- OM : Deref + Send + Sync ,
166- CMH : Deref + Send + Sync ,
167- NS : Deref + Send + Sync ,
168- > GossipVerifier < S , Blocks , L , Descriptor , CM , OM , CMH , NS > where
153+ APM : Deref + Send + Sync + Clone ,
154+ > GossipVerifier < S , Blocks , L , APM > where
169155 Blocks :: Target : UtxoSource ,
170156 L :: Target : Logger ,
171- CM :: Target : ChannelMessageHandler ,
172- OM :: Target : OnionMessageHandler ,
173- CMH :: Target : CustomMessageHandler ,
174- NS :: Target : NodeSigner ,
157+ APM :: Target : APeerManager ,
175158{
176159 /// Constructs a new [`GossipVerifier`].
177160 ///
178161 /// This is expected to be given to a [`P2PGossipSync`] (initially constructed with `None` for
179162 /// the UTXO lookup) via [`P2PGossipSync::add_utxo_lookup`].
180- pub fn new ( source : Blocks , spawn : S , gossiper : Arc < P2PGossipSync < Arc < NetworkGraph < L > > , Self , L > > , peer_manager : Arc < PeerManager < Descriptor , CM , Arc < P2PGossipSync < Arc < NetworkGraph < L > > , Self , L > > , OM , L , CMH , NS > > ) -> Self {
163+ pub fn new ( source : Blocks , spawn : S , gossiper : Arc < P2PGossipSync < Arc < NetworkGraph < L > > , Self , L > > , peer_manager : APM ) -> Self {
181164 Self {
182165 source, spawn, gossiper, peer_manager,
183166 block_cache : Arc :: new ( Mutex :: new ( VecDeque :: with_capacity ( BLOCK_CACHE_SIZE ) ) ) ,
@@ -269,18 +252,11 @@ impl<S: FutureSpawner,
269252impl < S : FutureSpawner ,
270253 Blocks : Deref + Send + Sync + Clone ,
271254 L : Deref + Send + Sync ,
272- Descriptor : SocketDescriptor + Send + Sync ,
273- CM : Deref + Send + Sync ,
274- OM : Deref + Send + Sync ,
275- CMH : Deref + Send + Sync ,
276- NS : Deref + Send + Sync ,
277- > Deref for GossipVerifier < S , Blocks , L , Descriptor , CM , OM , CMH , NS > where
255+ APM : Deref + Send + Sync + Clone ,
256+ > Deref for GossipVerifier < S , Blocks , L , APM > where
278257 Blocks :: Target : UtxoSource ,
279258 L :: Target : Logger ,
280- CM :: Target : ChannelMessageHandler ,
281- OM :: Target : OnionMessageHandler ,
282- CMH :: Target : CustomMessageHandler ,
283- NS :: Target : NodeSigner ,
259+ APM :: Target : APeerManager ,
284260{
285261 type Target = Self ;
286262 fn deref ( & self ) -> & Self { self }
@@ -290,30 +266,23 @@ impl<S: FutureSpawner,
290266impl < S : FutureSpawner ,
291267 Blocks : Deref + Send + Sync + Clone ,
292268 L : Deref + Send + Sync ,
293- Descriptor : SocketDescriptor + Send + Sync ,
294- CM : Deref + Send + Sync ,
295- OM : Deref + Send + Sync ,
296- CMH : Deref + Send + Sync ,
297- NS : Deref + Send + Sync ,
298- > UtxoLookup for GossipVerifier < S , Blocks , L , Descriptor , CM , OM , CMH , NS > where
269+ APM : Deref + Send + Sync + Clone ,
270+ > UtxoLookup for GossipVerifier < S , Blocks , L , APM > where
299271 Blocks :: Target : UtxoSource ,
300272 L :: Target : Logger ,
301- CM :: Target : ChannelMessageHandler ,
302- OM :: Target : OnionMessageHandler ,
303- CMH :: Target : CustomMessageHandler ,
304- NS :: Target : NodeSigner ,
273+ APM :: Target : APeerManager ,
305274{
306275 fn get_utxo ( & self , _chain_hash : & ChainHash , short_channel_id : u64 ) -> UtxoResult {
307276 let res = UtxoFuture :: new ( ) ;
308277 let fut = res. clone ( ) ;
309278 let source = self . source . clone ( ) ;
310279 let gossiper = Arc :: clone ( & self . gossiper ) ;
311280 let block_cache = Arc :: clone ( & self . block_cache ) ;
312- let pm = Arc :: clone ( & self . peer_manager ) ;
281+ let pm = self . peer_manager . clone ( ) ;
313282 self . spawn . spawn ( async move {
314283 let res = Self :: retrieve_utxo ( source, block_cache, short_channel_id) . await ;
315284 fut. resolve ( gossiper. network_graph ( ) , & * gossiper, res) ;
316- pm. process_events ( ) ;
285+ pm. as_ref ( ) . process_events ( ) ;
317286 } ) ;
318287 UtxoResult :: Async ( res)
319288 }
0 commit comments