Skip to content

Commit

Permalink
Deliver messages to untracked publisher chains. (#2768)
Browse files Browse the repository at this point in the history
* Fix subscriptions to untracked chains.

* Update linera-core/src/chain_worker/state/mod.rs

Co-authored-by: Andre da Silva <[email protected]>
Signed-off-by: Mathieu Baudet <[email protected]>

---------

Signed-off-by: Mathieu Baudet <[email protected]>
Co-authored-by: Mathieu Baudet <[email protected]>
Co-authored-by: Andre da Silva <[email protected]>
  • Loading branch information
3 people authored Nov 1, 2024
1 parent 24e24c5 commit 5d1b393
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion linera-core/src/chain_worker/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,22 @@ where
let mut heights_by_recipient = BTreeMap::<_, BTreeMap<_, _>>::new();
let mut targets = self.chain.outboxes.indices().await?;
if let Some(tracked_chains) = self.tracked_chains.as_ref() {
let publishers = self
.chain
.execution_state
.system
.subscriptions
.indices()
.await?
.iter()
.map(|subscription| subscription.chain_id)
.collect::<HashSet<_>>();
let tracked_chains = tracked_chains
.read()
.expect("Panics should not happen while holding a lock to `tracked_chains`");
targets.retain(|target| tracked_chains.contains(&target.recipient));
targets.retain(|target| {
tracked_chains.contains(&target.recipient) || publishers.contains(&target.recipient)
});
}
let outboxes = self.chain.outboxes.try_load_entries(&targets).await?;
for (target, outbox) in targets.into_iter().zip(outboxes) {
Expand Down

0 comments on commit 5d1b393

Please sign in to comment.