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

Commit 6dfdeab

Browse files
authored
Do not leak active head data in statement distribution (#3519)
1 parent 34ad3ab commit 6dfdeab

File tree

1 file changed

+10
-12
lines changed
  • node/network/statement-distribution/src

1 file changed

+10
-12
lines changed

node/network/statement-distribution/src/lib.rs

+10-12
Original file line numberDiff line numberDiff line change
@@ -1847,6 +1847,16 @@ impl StatementDistribution {
18471847
FromOverseer::Signal(OverseerSignal::ActiveLeaves(ActiveLeavesUpdate { activated, deactivated })) => {
18481848
let _timer = metrics.time_active_leaves_update();
18491849

1850+
for deactivated in deactivated {
1851+
if active_heads.remove(&deactivated).is_some() {
1852+
tracing::trace!(
1853+
target: LOG_TARGET,
1854+
hash = ?deactivated,
1855+
"Deactivating leaf",
1856+
);
1857+
}
1858+
}
1859+
18501860
for activated in activated {
18511861
let relay_parent = activated.hash;
18521862
let span = PerLeafSpan::new(activated.span, "statement-distribution");
@@ -1862,18 +1872,6 @@ impl StatementDistribution {
18621872

18631873
active_heads.entry(relay_parent)
18641874
.or_insert(ActiveHeadData::new(session_info.validators.clone(), session_index, span));
1865-
1866-
active_heads.retain(|h, _| {
1867-
let live = !deactivated.contains(h);
1868-
if !live {
1869-
tracing::trace!(
1870-
target: LOG_TARGET,
1871-
hash = ?h,
1872-
"Deactivating leaf",
1873-
);
1874-
}
1875-
live
1876-
});
18771875
}
18781876
}
18791877
FromOverseer::Signal(OverseerSignal::BlockFinalized(..)) => {

0 commit comments

Comments
 (0)