Timestamp: set_timestamp sets DidUpdate (#11960)

* Timestamp: `set_timestamp` sets `DidUpdate`

There exists the `set_timestamp` in the Timestamp pallet for setting the current timestamp. The
problem is that it doesn't set `DidUpdate`. This results in `on_finalize` panicking. There is no
real reason why the function doesn't also set `DidUpdate`.

* Update frame/timestamp/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix Babe tests

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Bastian Köcher
2022-08-04 11:34:19 +02:00
committed by GitHub
parent b8ad45373f
commit 753907a184
4 changed files with 6 additions and 5 deletions
+2
View File
@@ -282,6 +282,8 @@ impl<T: Config> Pallet<T> {
#[cfg(any(feature = "runtime-benchmarks", feature = "std"))]
pub fn set_timestamp(now: T::Moment) {
Now::<T>::put(now);
DidUpdate::<T>::put(true);
<T::OnTimestampSet as OnTimestampSet<_>>::on_timestamp_set(now);
}
}