Scheduler pre block limit note (#13231)

Co-authored-by: parity-processbot <>
This commit is contained in:
Muharem Ismailov
2023-04-03 12:59:01 +02:00
committed by GitHub
parent 7e3e3db282
commit e524bf0e30
3 changed files with 16 additions and 10 deletions
+9 -10
View File
@@ -874,22 +874,21 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
let when = (when.saturating_add(alarm_interval.saturating_sub(One::one())) /
alarm_interval)
.saturating_mul(alarm_interval);
let maybe_result = T::Scheduler::schedule(
let result = T::Scheduler::schedule(
DispatchTime::At(when),
None,
128u8,
frame_system::RawOrigin::Root.into(),
call,
)
.ok()
.map(|x| (when, x));
debug_assert!(
maybe_result.is_some(),
"Unable to schedule a new alarm at #{:?} (now: #{:?})?!",
when,
frame_system::Pallet::<T>::block_number()
);
maybe_result
debug_assert!(
result.is_ok(),
"Unable to schedule a new alarm at #{:?} (now: #{:?}), scheduler error: `{:?}`",
when,
frame_system::Pallet::<T>::block_number(),
result.unwrap_err(),
);
result.ok().map(|x| (when, x))
}
/// Mutate a referendum's `status` into the correct deciding state.