@@ -64,6 +64,7 @@ pub(crate) struct RequestResultCache {
6464 unapplied_slashes : LruMap < Hash , Vec < ( SessionIndex , CandidateHash , slashing:: PendingSlashes ) > > ,
6565 key_ownership_proof : LruMap < ( Hash , ValidatorId ) , Option < slashing:: OpaqueKeyOwnershipProof > > ,
6666 minimum_backing_votes : LruMap < SessionIndex , u32 > ,
67+ disabled_validators : LruMap < Hash , Vec < ValidatorIndex > > ,
6768 para_backing_state : LruMap < ( Hash , ParaId ) , Option < async_backing:: BackingState > > ,
6869 async_backing_params : LruMap < Hash , async_backing:: AsyncBackingParams > ,
6970}
@@ -96,6 +97,7 @@ impl Default for RequestResultCache {
9697 unapplied_slashes : LruMap :: new ( ByLength :: new ( DEFAULT_CACHE_CAP ) ) ,
9798 key_ownership_proof : LruMap :: new ( ByLength :: new ( DEFAULT_CACHE_CAP ) ) ,
9899 minimum_backing_votes : LruMap :: new ( ByLength :: new ( DEFAULT_CACHE_CAP ) ) ,
100+ disabled_validators : LruMap :: new ( ByLength :: new ( DEFAULT_CACHE_CAP ) ) ,
99101 para_backing_state : LruMap :: new ( ByLength :: new ( DEFAULT_CACHE_CAP ) ) ,
100102 async_backing_params : LruMap :: new ( ByLength :: new ( DEFAULT_CACHE_CAP ) ) ,
101103 }
@@ -444,6 +446,21 @@ impl RequestResultCache {
444446 self . minimum_backing_votes . insert ( session_index, minimum_backing_votes) ;
445447 }
446448
449+ pub ( crate ) fn disabled_validators (
450+ & mut self ,
451+ relay_parent : & Hash ,
452+ ) -> Option < & Vec < ValidatorIndex > > {
453+ self . disabled_validators . get ( relay_parent) . map ( |v| & * v)
454+ }
455+
456+ pub ( crate ) fn cache_disabled_validators (
457+ & mut self ,
458+ relay_parent : Hash ,
459+ disabled_validators : Vec < ValidatorIndex > ,
460+ ) {
461+ self . disabled_validators . insert ( relay_parent, disabled_validators) ;
462+ }
463+
447464 pub ( crate ) fn para_backing_state (
448465 & mut self ,
449466 key : ( Hash , ParaId ) ,
@@ -520,6 +537,7 @@ pub(crate) enum RequestResult {
520537 slashing:: OpaqueKeyOwnershipProof ,
521538 Option < ( ) > ,
522539 ) ,
540+ DisabledValidators ( Hash , Vec < ValidatorIndex > ) ,
523541 ParaBackingState ( Hash , ParaId , Option < async_backing:: BackingState > ) ,
524542 AsyncBackingParams ( Hash , async_backing:: AsyncBackingParams ) ,
525543}
0 commit comments