mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Weight annotation for block hooks. (#4058)
* Initial version that works with proper tests. * get rid of todos and grumbles and such. * Cleanup and fix line-width * fix test runtime test
This commit is contained in:
@@ -498,13 +498,18 @@ decl_module! {
|
||||
<Dummy<T>>::put(new_value);
|
||||
}
|
||||
|
||||
// The signature could also look like: `fn on_initialize()`
|
||||
// The signature could also look like: `fn on_initialize()`.
|
||||
// This function could also very well have a weight annotation, similar to any other. The
|
||||
// only difference being that if it is not annotated, the default is
|
||||
// `SimpleDispatchInfo::zero()`, which resolves into no weight.
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(1000)]
|
||||
fn on_initialize(_n: T::BlockNumber) {
|
||||
// Anything that needs to be done at the start of the block.
|
||||
// We don't do anything here.
|
||||
}
|
||||
|
||||
// The signature could also look like: `fn on_finalize()`
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(2000)]
|
||||
fn on_finalize(_n: T::BlockNumber) {
|
||||
// Anything that needs to be done at the end of the block.
|
||||
// We just kill our dummy storage item.
|
||||
|
||||
Reference in New Issue
Block a user