Skip to content

Commit

Permalink
Fix subscriptions to untracked chains.
Browse files Browse the repository at this point in the history
  • Loading branch information
afck committed Oct 31, 2024
1 parent eec186d commit 740310e
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 mut publishers = HashSet::new();
self.chain
.execution_state
.system
.subscriptions
.for_each_index(|subscription| {
publishers.insert(subscription.chain_id);
Ok(())
})
.await?;
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 740310e

Please sign in to comment.