@@ -42,6 +42,20 @@ pub trait UtxoSource: BlockSource + 'static {
4242 ) -> impl Future < Output = BlockSourceResult < bool > > + Send + ' a ;
4343}
4444
45+ impl < T : UtxoSource + ?Sized , U : Deref < Target = T > + Send + Sync + ' static > UtxoSource for U {
46+ fn get_block_hash_by_height < ' a > (
47+ & ' a self , block_height : u32 ,
48+ ) -> impl Future < Output = BlockSourceResult < BlockHash > > + Send + ' a {
49+ self . deref ( ) . get_block_hash_by_height ( block_height)
50+ }
51+
52+ fn is_output_unspent < ' a > (
53+ & ' a self , outpoint : OutPoint ,
54+ ) -> impl Future < Output = BlockSourceResult < bool > > + Send + ' a {
55+ self . deref ( ) . is_output_unspent ( outpoint)
56+ }
57+ }
58+
4559#[ cfg( feature = "tokio" ) ]
4660/// A trivial [`FutureSpawner`] which delegates to `tokio::spawn`.
4761pub struct TokioSpawner ;
@@ -129,21 +143,15 @@ impl<
129143/// value of 1024 should more than suffice), and ensure you have sufficient file descriptors
130144/// available on both Bitcoin Core and your LDK application for each request to hold its own
131145/// connection.
132- pub struct GossipVerifier < S : FutureSpawner , Blocks : Deref + Send + Sync + ' static + Clone >
133- where
134- Blocks :: Target : UtxoSource ,
135- {
146+ pub struct GossipVerifier < S : FutureSpawner , Blocks : UtxoSource + Clone > {
136147 source : Blocks ,
137148 spawn : S ,
138149 block_cache : Arc < Mutex < VecDeque < ( u32 , Block ) > > > ,
139150}
140151
141152const BLOCK_CACHE_SIZE : usize = 5 ;
142153
143- impl < S : FutureSpawner , Blocks : Deref + Send + Sync + Clone > GossipVerifier < S , Blocks >
144- where
145- Blocks :: Target : UtxoSource ,
146- {
154+ impl < S : FutureSpawner , Blocks : UtxoSource + Clone > GossipVerifier < S , Blocks > {
147155 /// Constructs a new [`GossipVerifier`] for use in a [`P2PGossipSync`].
148156 ///
149157 /// [`P2PGossipSync`]: lightning::routing::gossip::P2PGossipSync
@@ -239,10 +247,7 @@ where
239247 }
240248}
241249
242- impl < S : FutureSpawner , Blocks : Deref + Send + Sync + Clone > UtxoLookup for GossipVerifier < S , Blocks >
243- where
244- Blocks :: Target : UtxoSource ,
245- {
250+ impl < S : FutureSpawner , Blocks : UtxoSource + Clone > UtxoLookup for GossipVerifier < S , Blocks > {
246251 fn get_utxo ( & self , _chain_hash : & ChainHash , scid : u64 , notifier : Arc < Notifier > ) -> UtxoResult {
247252 let res = UtxoFuture :: new ( notifier) ;
248253 let fut = res. clone ( ) ;
0 commit comments