Skip to content

Commit

Permalink
statement-distribution: Ensure we deactivate leaves before activating (
Browse files Browse the repository at this point in the history
…#3042)

As activation can fail, we ensure that we don't miss deactivation of
leaves.
  • Loading branch information
bkchr authored Jan 24, 2024
1 parent 488cbe6 commit a989ddf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion polkadot/node/network/statement-distribution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,10 @@ 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 {
v2::handle_active_leaves_update(ctx, state, activated, mode).await?;
// Ensure we deactivate first, before we activate the new block.
// Activation can fail and then we would skip the deactivation.
v2::handle_deactivate_leaves(state, &deactivated);
v2::handle_active_leaves_update(ctx, state, activated, mode).await?;
} 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 a989ddf

Please sign in to comment.