Revert loop prevention (#4472)

* Provisioner: Only include and sign bitfields on fresh leaves.
This commit is contained in:
Robert Klotzner
2021-12-13 12:20:49 +01:00
committed by GitHub
parent a94accb57e
commit bd5721fbf5
9 changed files with 59 additions and 47 deletions
@@ -35,7 +35,7 @@ use futures::{
use polkadot_node_subsystem_util::runtime::{get_occupied_cores, RuntimeInfo};
use polkadot_primitives::v1::{CandidateHash, Hash, OccupiedCore};
use polkadot_subsystem::{
messages::AllMessages, ActivatedLeaf, ActiveLeavesUpdate, SubsystemContext,
messages::AllMessages, ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, SubsystemContext,
};
use super::{Metrics, LOG_TARGET};
@@ -97,6 +97,11 @@ impl Requester {
{
tracing::trace!(target: LOG_TARGET, ?update, "Update fetching heads");
let ActiveLeavesUpdate { activated, deactivated } = update;
// Stale leaves happen after a reversion - we don't want to re-run availability there.
let activated = activated.and_then(|h| match h.status {
LeafStatus::Stale => None,
LeafStatus::Fresh => Some(h),
});
// Order important! We need to handle activated, prior to deactivated, otherwise we might
// cancel still needed jobs.
self.start_requesting_chunks(ctx, runtime, activated.into_iter()).await?;