Skip to content

Commit

Permalink
statement-dist: activate leaves before unconditional deactivate (pari…
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier authored Jan 24, 2024
1 parent 50eb12c commit 5b8abbc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions polkadot/node/network/statement-distribution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,12 @@ impl<R: rand::Rng> StatementDistributionSubsystem<R> {
if let Some(ref activated) = activated {
let mode = prospective_parachains_mode(ctx.sender(), activated.hash).await?;
if let ProspectiveParachainsMode::Enabled { .. } = mode {
// Ensure we deactivate first, before we activate the new block.
// Activation can fail and then we would skip the deactivation.
let res =
v2::handle_active_leaves_update(ctx, state, activated, mode).await;
// Regardless of the result of leaf activation, we always prune before
// handling it to avoid leaks.
v2::handle_deactivate_leaves(state, &deactivated);
v2::handle_active_leaves_update(ctx, state, activated, mode).await?;
res?;
} else if let ProspectiveParachainsMode::Disabled = mode {
for deactivated in &deactivated {
crate::legacy_v1::handle_deactivate_leaf(legacy_v1_state, *deactivated);
Expand Down

0 comments on commit 5b8abbc

Please sign in to comment.