Skip to content

Commit aca3979

Browse files
committed
Take circular GossipVerifier reference by Arc
Our current architecture requires `GossipVerifier`'s type signature to include a circular reference to itself. Previously, we directly gave that as `Self`, which however did not work when setting it dynamically under all circumstances. Here we take `Self` by `Arc` mitigate this issue.
1 parent 12920d8 commit aca3979

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lightning-block-sync/src/gossip.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ pub struct GossipVerifier<
144144
{
145145
source: Blocks,
146146
peer_manager_wake: Arc<dyn Fn() + Send + Sync>,
147-
gossiper: Arc<P2PGossipSync<Arc<NetworkGraph<L>>, Self, L>>,
147+
gossiper: Arc<P2PGossipSync<Arc<NetworkGraph<L>>, Arc<Self>, L>>,
148148
spawn: S,
149149
block_cache: Arc<Mutex<VecDeque<(u32, Block)>>>,
150150
}
@@ -162,7 +162,7 @@ where
162162
/// This is expected to be given to a [`P2PGossipSync`] (initially constructed with `None` for
163163
/// the UTXO lookup) via [`P2PGossipSync::add_utxo_lookup`].
164164
pub fn new<APM: Deref + Send + Sync + Clone + 'static>(
165-
source: Blocks, spawn: S, gossiper: Arc<P2PGossipSync<Arc<NetworkGraph<L>>, Self, L>>,
165+
source: Blocks, spawn: S, gossiper: Arc<P2PGossipSync<Arc<NetworkGraph<L>>, Arc<Self>, L>>,
166166
peer_manager: APM,
167167
) -> Self
168168
where

0 commit comments

Comments
 (0)