srml: staking: track session index of current era start (#3203)

* srml: staking: track session index of current era start

* node: bump spec_version
This commit is contained in:
André Silva
2019-07-25 13:22:46 +01:00
committed by Bastian Köcher
parent 002acb9373
commit b633f93b00
2 changed files with 8 additions and 2 deletions
+2 -2
View File
@@ -79,8 +79,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to equal spec_version. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 120,
impl_version: 120,
spec_version: 121,
impl_version: 121,
apis: RUNTIME_API_VERSIONS,
};
+6
View File
@@ -590,6 +590,9 @@ decl_storage! {
/// The start of the current era.
pub CurrentEraStart get(current_era_start): MomentOf<T>;
/// The session index at which the current era started.
pub CurrentEraStartSessionIndex get(current_era_start_session_index): SessionIndex;
/// Rewards for the current era. Using indices of current elected set.
pub CurrentEraRewards: EraRewards;
@@ -1169,6 +1172,9 @@ impl<T: Trait> Module<T> {
// Increment current era.
let current_era = CurrentEra::mutate(|s| { *s += 1; *s });
CurrentEraStartSessionIndex::mutate(|v| {
*v = start_session_index;
});
let bonding_duration = T::BondingDuration::get();
if current_era > bonding_duration {