Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit c37bb08

Browse files
andresilvagavofyork
authored andcommitted
srml-timestamp: define max timestamp drift in millis (#4077)
* srml-timestamp: define max timestamp drift in millis * srml-timestamp: suffix MAX_TIMESTAMP_DRIFT with unit
1 parent db7657a commit c37bb08

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

srml/timestamp/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ impl<T: Trait> ProvideInherent for Module<T> {
288288
}
289289

290290
fn check_inherent(call: &Self::Call, data: &InherentData) -> result::Result<(), Self::Error> {
291-
const MAX_TIMESTAMP_DRIFT: u64 = 60;
291+
const MAX_TIMESTAMP_DRIFT_MILLIS: u64 = 30 * 1000;
292292

293293
let t: u64 = match call {
294294
Call::set(ref t) => t.clone().saturated_into::<u64>(),
@@ -298,7 +298,7 @@ impl<T: Trait> ProvideInherent for Module<T> {
298298
let data = extract_inherent_data(data).map_err(|e| InherentError::Other(e))?;
299299

300300
let minimum = (Self::now() + T::MinimumPeriod::get()).saturated_into::<u64>();
301-
if t > data + MAX_TIMESTAMP_DRIFT {
301+
if t > data + MAX_TIMESTAMP_DRIFT_MILLIS {
302302
Err(InherentError::Other("Timestamp too far in future to accept".into()))
303303
} else if t < minimum {
304304
Err(InherentError::ValidAtTimestamp(minimum))

0 commit comments

Comments
 (0)