Trait frame_support::traits::OnInitialize
source · pub trait OnInitialize<BlockNumber> {
fn on_initialize(_n: BlockNumber) -> Weight { ... }
}
Expand description
The block initialization trait.
Implementing this lets you express what should happen for your pallet when the block is beginning (right before the first extrinsic is executed).
Provided Methods§
sourcefn on_initialize(_n: BlockNumber) -> Weight
fn on_initialize(_n: BlockNumber) -> Weight
The block is being initialized. Implement to have something happen.
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.