Add support for modules to require inherent to be present (#5792)

* Add support for modules to require inherent to be present

* Bump node impl version

* Allow is_inherent_required itself to return error

This handles the case if runtime fails to check the inherent data (if the
inherent data is invalid, etc).

* typo: &module -> $module

* fix: iter
This commit is contained in:
Wei Tang
2020-04-29 12:05:35 +02:00
committed by GitHub
parent ba50664fea
commit 521f8ff427
3 changed files with 43 additions and 3 deletions
@@ -408,6 +408,11 @@ pub trait ProvideInherent {
/// Create an inherent out of the given `InherentData`.
fn create_inherent(data: &InherentData) -> Option<Self::Call>;
/// If `Some`, indicates that an inherent is required. Check will return the inner error if no
/// inherent is found. If `Err`, indicates that the check failed and further operations should
/// be aborted.
fn is_inherent_required(_: &InherentData) -> Result<Option<Self::Error>, Self::Error> { Ok(None) }
/// Check the given inherent if it is valid.
/// Checking the inherent is optional and can be omitted.
fn check_inherent(_: &Self::Call, _: &InherentData) -> Result<(), Self::Error> {