Trait frame_support::traits::OnIdle
source · pub trait OnIdle<BlockNumber> {
// Provided method
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight { ... }
}
Expand description
The block’s on idle trait.
Implementing this lets you express what should happen for your pallet before
block finalization (see on_finalize
hook) in case any remaining weight is left.
Provided Methods§
sourcefn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
The block is being finalized.
Implement to have something happen in case there is leftover weight.
Check the passed remaining_weight
to make sure it is high enough to allow for
your pallet’s extra computation.
NOTE: This function is called AFTER ALL extrinsics - including inherent extrinsics -
in a block are applied but before on_finalize
is executed.