Add extra docs to on_initialize (#7552)

* Add some extra on_initialize docs.

* Address review comments.
This commit is contained in:
Tomasz Drwięga
2020-11-18 21:10:00 +01:00
committed by GitHub
parent 1b62b5dc59
commit 0e9e2ed5a8
+7
View File
@@ -1427,6 +1427,9 @@ pub trait GetCallMetadata {
#[impl_for_tuples(30)] #[impl_for_tuples(30)]
pub trait OnFinalize<BlockNumber> { pub trait OnFinalize<BlockNumber> {
/// The block is being finalized. Implement to have something happen. /// The block is being finalized. Implement to have something happen.
///
/// NOTE: This function is called AFTER ALL extrinsics in a block are applied,
/// including inherent extrinsics.
fn on_finalize(_n: BlockNumber) {} fn on_finalize(_n: BlockNumber) {}
} }
@@ -1438,6 +1441,10 @@ pub trait OnInitialize<BlockNumber> {
/// The block is being initialized. Implement to have something happen. /// The block is being initialized. Implement to have something happen.
/// ///
/// Return the non-negotiable weight consumed in the block. /// Return the non-negotiable weight consumed in the block.
///
/// NOTE: This function is called BEFORE ANY extrinsic in a block is applied,
/// including inherent extrinsics. Hence for instance, if you runtime includes
/// `pallet_timestamp`, the `timestamp` is not yet up to date at this point.
fn on_initialize(_n: BlockNumber) -> crate::weights::Weight { 0 } fn on_initialize(_n: BlockNumber) -> crate::weights::Weight { 0 }
} }