X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-block-sync%2Fsrc%2Fgossip.rs;h=9cd4049679c30fd5d7ddd2f86562d6df81758447;hb=4b70921c958181e43dc056dc05ef59427d13f2af;hp=591b0298793ffb3baadb1d0ee0009b1199a95941;hpb=f352d03ee98aed3d940e697fcb09371cfdc3ab15;p=rust-lightning diff --git a/lightning-block-sync/src/gossip.rs b/lightning-block-sync/src/gossip.rs index 591b0298..9cd40496 100644 --- a/lightning-block-sync/src/gossip.rs +++ b/lightning-block-sync/src/gossip.rs @@ -132,14 +132,12 @@ impl< pub struct GossipVerifier where Blocks::Target: UtxoSource, L::Target: Logger, - APM::Target: APeerManager, { source: Blocks, - peer_manager: APM, + peer_manager_wake: Arc, gossiper: Arc>, Self, L>>, spawn: S, block_cache: Arc>>, @@ -150,19 +148,20 @@ const BLOCK_CACHE_SIZE: usize = 5; impl GossipVerifier where +> GossipVerifier where Blocks::Target: UtxoSource, L::Target: Logger, - APM::Target: APeerManager, { /// Constructs a new [`GossipVerifier`]. /// /// This is expected to be given to a [`P2PGossipSync`] (initially constructed with `None` for /// the UTXO lookup) via [`P2PGossipSync::add_utxo_lookup`]. - pub fn new(source: Blocks, spawn: S, gossiper: Arc>, Self, L>>, peer_manager: APM) -> Self { + pub fn new( + source: Blocks, spawn: S, gossiper: Arc>, Self, L>>, peer_manager: APM + ) -> Self where APM::Target: APeerManager { + let peer_manager_wake = Arc::new(move || peer_manager.as_ref().process_events()); Self { - source, spawn, gossiper, peer_manager, + source, spawn, gossiper, peer_manager_wake, block_cache: Arc::new(Mutex::new(VecDeque::with_capacity(BLOCK_CACHE_SIZE))), } } @@ -252,11 +251,9 @@ impl Deref for GossipVerifier where +> Deref for GossipVerifier where Blocks::Target: UtxoSource, L::Target: Logger, - APM::Target: APeerManager, { type Target = Self; fn deref(&self) -> &Self { self } @@ -266,11 +263,9 @@ impl UtxoLookup for GossipVerifier where +> UtxoLookup for GossipVerifier where Blocks::Target: UtxoSource, L::Target: Logger, - APM::Target: APeerManager, { fn get_utxo(&self, _chain_hash: &ChainHash, short_channel_id: u64) -> UtxoResult { let res = UtxoFuture::new(); @@ -278,11 +273,11 @@ impl