Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Do not leak active head data in statement distribution (#3519)
Browse files Browse the repository at this point in the history
  • Loading branch information
koute authored Jul 26, 2021
1 parent 34ad3ab commit 6dfdeab
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions node/network/statement-distribution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1847,6 +1847,16 @@ impl StatementDistribution {
FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate { activated, deactivated })) => {
let _timer = metrics.time_active_leaves_update();

for deactivated in deactivated {
if active_heads.remove(&deactivated).is_some() {
tracing::trace!(
target: LOG_TARGET,
hash = ?deactivated,
"Deactivating leaf",
);
}
}

for activated in activated {
let relay_parent = activated.hash;
let span = PerLeafSpan::new(activated.span, "statement-distribution");
Expand All @@ -1862,18 +1872,6 @@ impl StatementDistribution {

active_heads.entry(relay_parent)
.or_insert(ActiveHeadData::new(session_info.validators.clone(), session_index, span));

active_heads.retain(|h, _| {
let live = !deactivated.contains(h);
if !live {
tracing::trace!(
target: LOG_TARGET,
hash = ?h,
"Deactivating leaf",
);
}
live
});
}
}
FromOverseer::Signal(OverseerSignal::BlockFinalized(..)) => {
Expand Down

0 comments on commit 6dfdeab

Please sign in to comment.