mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-24 21:51:08 +00:00
Disabled validators runtime API (#1257)
Exposes disabled validators list via a runtime API. --------- Co-authored-by: ordian <noreply@reusable.software> Co-authored-by: ordian <write@reusable.software>
This commit is contained in:
committed by
GitHub
parent
f0e6d2ad52
commit
7aace06b3d
@@ -64,6 +64,7 @@ pub(crate) struct RequestResultCache {
|
||||
unapplied_slashes: LruMap<Hash, Vec<(SessionIndex, CandidateHash, slashing::PendingSlashes)>>,
|
||||
key_ownership_proof: LruMap<(Hash, ValidatorId), Option<slashing::OpaqueKeyOwnershipProof>>,
|
||||
minimum_backing_votes: LruMap<SessionIndex, u32>,
|
||||
disabled_validators: LruMap<Hash, Vec<ValidatorIndex>>,
|
||||
para_backing_state: LruMap<(Hash, ParaId), Option<async_backing::BackingState>>,
|
||||
async_backing_params: LruMap<Hash, async_backing::AsyncBackingParams>,
|
||||
}
|
||||
@@ -96,6 +97,7 @@ impl Default for RequestResultCache {
|
||||
unapplied_slashes: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
|
||||
key_ownership_proof: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
|
||||
minimum_backing_votes: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
|
||||
disabled_validators: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
|
||||
para_backing_state: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
|
||||
async_backing_params: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
|
||||
}
|
||||
@@ -444,6 +446,21 @@ impl RequestResultCache {
|
||||
self.minimum_backing_votes.insert(session_index, minimum_backing_votes);
|
||||
}
|
||||
|
||||
pub(crate) fn disabled_validators(
|
||||
&mut self,
|
||||
relay_parent: &Hash,
|
||||
) -> Option<&Vec<ValidatorIndex>> {
|
||||
self.disabled_validators.get(relay_parent).map(|v| &*v)
|
||||
}
|
||||
|
||||
pub(crate) fn cache_disabled_validators(
|
||||
&mut self,
|
||||
relay_parent: Hash,
|
||||
disabled_validators: Vec<ValidatorIndex>,
|
||||
) {
|
||||
self.disabled_validators.insert(relay_parent, disabled_validators);
|
||||
}
|
||||
|
||||
pub(crate) fn para_backing_state(
|
||||
&mut self,
|
||||
key: (Hash, ParaId),
|
||||
@@ -520,6 +537,7 @@ pub(crate) enum RequestResult {
|
||||
slashing::OpaqueKeyOwnershipProof,
|
||||
Option<()>,
|
||||
),
|
||||
DisabledValidators(Hash, Vec<ValidatorIndex>),
|
||||
ParaBackingState(Hash, ParaId, Option<async_backing::BackingState>),
|
||||
AsyncBackingParams(Hash, async_backing::AsyncBackingParams),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user