0

I've seen some code like this

move |_, ()| async move {
    let uncles =
        sp_authorship::InherentDataProvider::<<Block as BlockT>::Header>::check_inherents();
    let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
    let slot =
        sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_duration(
            *timestamp,
            slot_duration,
        );

    Ok((timestamp, slot, uncles))
},

But I don't know what it means. If I remove one of them, the node still can be compiled and running without any issue.

Or I should ask what is InherentData. What does it use for?

1 Answer 1

0

InherentDataProvider is a type that provides data to inherents.

Each inherent is added to a produced block. Each runtime decides on which inherents it wants to attach to its blocks. All data that is required for the runtime to create the inherents is stored in the InherentData. This InherentData is constructed by the node and given to the runtime.

As to the specific code that you are referencing, maybe these two PR's can help:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.