Skip to content

Commit

Permalink
inject consensus info to fallback network
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-maron committed Sep 12, 2023
1 parent f7584ba commit c50ed0d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 5 additions & 3 deletions crates/hotshot/src/traits/networking/libp2p_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ impl<M: NetworkMsg, K: SignatureKey + 'static> Libp2pNetwork<M, K> {
topic_map,
node_lookup_send,
cache_gc_shutdown_send,
// Start the latest view from 0. "Latest" refers to "most recent view we are polling for
// proposals on". We need this because to have consensus info injected we need a working
// Start the latest view from 0. "Latest" refers to "most recent view we are polling for
// proposals on". We need this because to have consensus info injected we need a working
// network already. In the worst case, we send a few lookups we don't need.
latest_seen_view: Arc::new(AtomicU64::new(0)),
}),
Expand Down Expand Up @@ -743,7 +743,9 @@ impl<M: NetworkMsg, K: SignatureKey + 'static> ConnectedNetwork<M, K> for Libp2p

ConsensusIntentEvent::PollForProposal(new_view) => {
if new_view > self.inner.latest_seen_view.load(Ordering::Relaxed) {
self.inner.latest_seen_view.store(new_view, Ordering::Relaxed);
self.inner
.latest_seen_view
.store(new_view, Ordering::Relaxed);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,14 @@ impl<
<WebServerNetwork<_, _, _> as ConnectedNetwork<
Message<TYPES, I>,
TYPES::SignatureKey,
>>::inject_consensus_info(self.network(), event)
>>::inject_consensus_info(self.network(), event.clone())
.await;

<Libp2pNetwork<_, _> as ConnectedNetwork<
Message<TYPES, I>,
TYPES::SignatureKey,
>>::inject_consensus_info(self.fallback(), event)
.await;
}
}

Expand Down

0 comments on commit c50ed0d

Please sign in to comment.