Disable validators but don't kick them (#2870)

* Disable validators but don't kick them

* Bump runtime

* Remove stray printlns
This commit is contained in:
Gavin Wood
2019-06-15 10:29:34 +02:00
committed by GitHub
parent ad0011a1bd
commit ecf25c9289
6 changed files with 47 additions and 16 deletions
+7 -1
View File
@@ -359,10 +359,16 @@ impl<T: Trait> Module<T> {
}
/// Disable the validator of index `i`.
pub fn disable(i: usize) {
pub fn disable_index(i: usize) {
T::SessionHandler::on_disabled(i);
<Changed<T>>::put(true);
}
/// Disable the validator identified by `c`. (If using with the staking module, this would be
/// their *controller* account.)
pub fn disable(c: &T::AccountId) -> rstd::result::Result<(), ()> {
Self::validators().iter().position(|i| i == c).map(Self::disable_index).ok_or(())
}
}
impl<T: Trait> OnFreeBalanceZero<T::AccountId> for Module<T> {