mirror of
https://git.ghostchain.io/proxmio/ghost-node.git
synced 2025-12-27 11:19:57 +00:00
propagate disabled authorities to upcoming sessions in era
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
@@ -10,7 +10,7 @@ use frame_support::{
|
||||
traits::{
|
||||
tokens::fungible::{Inspect, Mutate},
|
||||
EstimateNextSessionRotation, Get, OneSessionHandler, ValidatorSet,
|
||||
ValidatorSetWithIdentification,
|
||||
ValidatorSetWithIdentification, DisabledValidators,
|
||||
},
|
||||
WeakBoundedVec,
|
||||
};
|
||||
@@ -199,6 +199,7 @@ pub mod pallet {
|
||||
IdentificationTuple<Self>,
|
||||
ThrottlingOffence<IdentificationTuple<Self>>,
|
||||
>;
|
||||
type DisabledValidators: DisabledValidators;
|
||||
|
||||
#[pallet::constant]
|
||||
type MaxAuthorities: Get<u32>;
|
||||
@@ -1104,7 +1105,15 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
Validators::<T>::insert(&session_index, bounded_validators);
|
||||
Authorities::<T>::set(&session_index, bounded_authorities);
|
||||
ClapsInSession::<T>::set(&session_index, Default::default());
|
||||
|
||||
let mut disabled_validators: BTreeMap<AuthIndex, SessionAuthorityInfo> = Default::default();
|
||||
for disabled_index in T::DisabledValidators::disabled_validators().iter() {
|
||||
let _ = disabled_validators.insert(*disabled_index, SessionAuthorityInfo {
|
||||
claps: 0u32,
|
||||
disabled: true,
|
||||
});
|
||||
}
|
||||
ClapsInSession::<T>::set(&session_index, disabled_validators);
|
||||
}
|
||||
|
||||
fn clear_history(target_session_index: &SessionIndex) {
|
||||
|
||||
@@ -206,6 +206,7 @@ impl Config for Runtime {
|
||||
type NetworkDataHandler = Networks;
|
||||
type BlockNumberProvider = System;
|
||||
type ReportUnresponsiveness = OffenceHandler;
|
||||
type DisabledValidators = Session;
|
||||
|
||||
type MaxAuthorities = ConstU32<5>;
|
||||
type ApplauseThreshold = ConstU32<50>;
|
||||
|
||||
Reference in New Issue
Block a user