@@ -9,10 +9,7 @@ use bitcoin::blockdata::constants::ChainHash;
9
9
use bitcoin:: blockdata:: transaction:: { TxOut , OutPoint } ;
10
10
use bitcoin:: hash_types:: BlockHash ;
11
11
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 ;
16
13
17
14
use lightning:: routing:: gossip:: { NetworkGraph , P2PGossipSync } ;
18
15
use lightning:: routing:: utxo:: { UtxoFuture , UtxoLookup , UtxoResult , UtxoLookupError } ;
@@ -135,21 +132,14 @@ impl<
135
132
pub struct GossipVerifier < S : FutureSpawner ,
136
133
Blocks : Deref + Send + Sync + ' static + Clone ,
137
134
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 ,
143
136
> where
144
137
Blocks :: Target : UtxoSource ,
145
138
L :: Target : Logger ,
146
- CM :: Target : ChannelMessageHandler ,
147
- OM :: Target : OnionMessageHandler ,
148
- CMH :: Target : CustomMessageHandler ,
149
- NS :: Target : NodeSigner ,
139
+ APM :: Target : APeerManager ,
150
140
{
151
141
source : Blocks ,
152
- peer_manager : Arc < PeerManager < Descriptor , CM , Arc < P2PGossipSync < Arc < NetworkGraph < L > > , Self , L > > , OM , L , CMH , NS > > ,
142
+ peer_manager : APM ,
153
143
gossiper : Arc < P2PGossipSync < Arc < NetworkGraph < L > > , Self , L > > ,
154
144
spawn : S ,
155
145
block_cache : Arc < Mutex < VecDeque < ( u32 , Block ) > > > ,
@@ -160,24 +150,17 @@ const BLOCK_CACHE_SIZE: usize = 5;
160
150
impl < S : FutureSpawner ,
161
151
Blocks : Deref + Send + Sync + Clone ,
162
152
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
169
155
Blocks :: Target : UtxoSource ,
170
156
L :: Target : Logger ,
171
- CM :: Target : ChannelMessageHandler ,
172
- OM :: Target : OnionMessageHandler ,
173
- CMH :: Target : CustomMessageHandler ,
174
- NS :: Target : NodeSigner ,
157
+ APM :: Target : APeerManager ,
175
158
{
176
159
/// Constructs a new [`GossipVerifier`].
177
160
///
178
161
/// This is expected to be given to a [`P2PGossipSync`] (initially constructed with `None` for
179
162
/// 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 {
181
164
Self {
182
165
source, spawn, gossiper, peer_manager,
183
166
block_cache : Arc :: new ( Mutex :: new ( VecDeque :: with_capacity ( BLOCK_CACHE_SIZE ) ) ) ,
@@ -269,18 +252,11 @@ impl<S: FutureSpawner,
269
252
impl < S : FutureSpawner ,
270
253
Blocks : Deref + Send + Sync + Clone ,
271
254
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
278
257
Blocks :: Target : UtxoSource ,
279
258
L :: Target : Logger ,
280
- CM :: Target : ChannelMessageHandler ,
281
- OM :: Target : OnionMessageHandler ,
282
- CMH :: Target : CustomMessageHandler ,
283
- NS :: Target : NodeSigner ,
259
+ APM :: Target : APeerManager ,
284
260
{
285
261
type Target = Self ;
286
262
fn deref ( & self ) -> & Self { self }
@@ -290,30 +266,23 @@ impl<S: FutureSpawner,
290
266
impl < S : FutureSpawner ,
291
267
Blocks : Deref + Send + Sync + Clone ,
292
268
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
299
271
Blocks :: Target : UtxoSource ,
300
272
L :: Target : Logger ,
301
- CM :: Target : ChannelMessageHandler ,
302
- OM :: Target : OnionMessageHandler ,
303
- CMH :: Target : CustomMessageHandler ,
304
- NS :: Target : NodeSigner ,
273
+ APM :: Target : APeerManager ,
305
274
{
306
275
fn get_utxo ( & self , _chain_hash : & ChainHash , short_channel_id : u64 ) -> UtxoResult {
307
276
let res = UtxoFuture :: new ( ) ;
308
277
let fut = res. clone ( ) ;
309
278
let source = self . source . clone ( ) ;
310
279
let gossiper = Arc :: clone ( & self . gossiper ) ;
311
280
let block_cache = Arc :: clone ( & self . block_cache ) ;
312
- let pm = Arc :: clone ( & self . peer_manager ) ;
281
+ let pm = self . peer_manager . clone ( ) ;
313
282
self . spawn . spawn ( async move {
314
283
let res = Self :: retrieve_utxo ( source, block_cache, short_channel_id) . await ;
315
284
fut. resolve ( gossiper. network_graph ( ) , & * gossiper, res) ;
316
- pm. process_events ( ) ;
285
+ pm. as_ref ( ) . process_events ( ) ;
317
286
} ) ;
318
287
UtxoResult :: Async ( res)
319
288
}
0 commit comments