CheckInherentError can now report when something would be valid (#1204)

* CheckInherentError can now report when something would be valid

* set timestamp inherent to next valid block time

* return max timestamp for valid-after when checking
This commit is contained in:
Robert Habermeier
2018-12-04 09:19:36 +01:00
committed by Bastian Köcher
parent 93b212d2cc
commit 9bccc9661c
6 changed files with 30 additions and 13 deletions
+1 -1
View File
@@ -1177,7 +1177,7 @@ impl<C, A> BaseProposer<<C as AuthoringApi>::Block> for Proposer<C, A> where
&inherent,
) {
Ok(Ok(())) => None,
Ok(Err(BlockBuilderError::TimestampInFuture(timestamp))) => Some(timestamp),
Ok(Err(BlockBuilderError::ValidAtTimestamp(timestamp))) => Some(timestamp),
Ok(Err(e)) => {
debug!(target: "rhd", "Invalid proposal (check_inherents): {:?}", e);
return Box::new(future::ok(false));
+4 -1
View File
@@ -487,7 +487,10 @@ impl BasicInherentData {
#[derive(Encode)]
#[cfg_attr(feature = "std", derive(Decode))]
pub enum CheckInherentError {
TimestampInFuture(u64),
/// The inherents are generally valid but a delay until the given timestamp
/// is required.
ValidAtTimestamp(u64),
/// Some other error has occurred.
Other(RuntimeString),
}