@@ -1010,7 +1010,8 @@ decl_storage! {
1010
1010
/// solutions to be submitted.
1011
1011
pub EraElectionStatus get( fn era_election_status) : ElectionStatus <T :: BlockNumber >;
1012
1012
1013
- /// True if the current planned session is final.
1013
+ /// True if the current **planned** session is final. Note that this does not take era
1014
+ /// forcing into account.
1014
1015
pub IsCurrentSessionFinal get( fn is_current_session_final) : bool = false ;
1015
1016
1016
1017
/// True if network has been upgraded to this version.
@@ -1166,7 +1167,8 @@ decl_module! {
1166
1167
if
1167
1168
// if we don't have any ongoing offchain compute.
1168
1169
Self :: era_election_status( ) . is_closed( ) &&
1169
- Self :: is_current_session_final( )
1170
+ // either current session final based on the plan, or we're forcing.
1171
+ ( Self :: is_current_session_final( ) || Self :: will_era_be_forced( ) )
1170
1172
{
1171
1173
if let Some ( next_session_change) = T :: NextNewSession :: estimate_next_new_session( now) {
1172
1174
if let Some ( remaining) = next_session_change. checked_sub( & now) {
@@ -2895,6 +2897,13 @@ impl<T: Trait> Module<T> {
2895
2897
}
2896
2898
}
2897
2899
2900
+ fn will_era_be_forced ( ) -> bool {
2901
+ match ForceEra :: get ( ) {
2902
+ Forcing :: ForceAlways | Forcing :: ForceNew => true ,
2903
+ Forcing :: ForceNone | Forcing :: NotForcing => false ,
2904
+ }
2905
+ }
2906
+
2898
2907
#[ cfg( feature = "runtime-benchmarks" ) ]
2899
2908
pub fn add_era_stakers ( current_era : EraIndex , controller : T :: AccountId , exposure : Exposure < T :: AccountId , BalanceOf < T > > ) {
2900
2909
<ErasStakers < T > >:: insert ( & current_era, & controller, & exposure) ;
0 commit comments