Fix staking bug (#5170)

* fix staking bug

* add some guarantee note in SessionManager while it is not fixed in staking

* bumpd impl version
This commit is contained in:
thiolliere
2020-03-06 18:31:48 +01:00
committed by GitHub
parent 3a792a55cd
commit 71ff24c79e
2 changed files with 7 additions and 10 deletions
+2
View File
@@ -156,6 +156,8 @@ pub trait SessionManager<ValidatorId> {
/// `new_index` is strictly greater than from previous call.
///
/// The first session start at index 0.
///
/// `new_session(session)` is guaranteed to be called before `end_session(session-1)`.
fn new_session(new_index: SessionIndex) -> Option<Vec<ValidatorId>>;
/// End the session.
///
+5 -10
View File
@@ -1659,17 +1659,12 @@ impl<T: Trait> Module<T> {
/// End a session potentially ending an era.
fn end_session(session_index: SessionIndex) {
if let Some(active_era) = Self::active_era() {
let next_active_era_start_session_index =
if let Some(next_active_era_start_session_index) =
Self::eras_start_session_index(active_era.index + 1)
.unwrap_or_else(|| {
frame_support::print(
"Error: start_session_index must be set for active_era + 1"
);
0
});
if next_active_era_start_session_index == session_index + 1 {
Self::end_era(active_era, session_index);
{
if next_active_era_start_session_index == session_index + 1 {
Self::end_era(active_era, session_index);
}
}
}
}