mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 20:21:06 +00:00
Rename OffchainWorker internal method. (#4267)
* Rename generate_extrinsics to offchain_worker * Some doc improvements.
This commit is contained in:
committed by
Gavin Wood
parent
2de6f82b8a
commit
3b21f7fdc3
@@ -346,18 +346,22 @@ pub trait OnInitialize<BlockNumber> {
|
||||
/// Off-chain computation trait.
|
||||
///
|
||||
/// Implementing this trait on a module allows you to perform long-running tasks
|
||||
/// that make validators generate extrinsics (either transactions or inherents)
|
||||
/// with the results of those long-running computations.
|
||||
/// that make (by default) validators generate transactions that feed results
|
||||
/// of those long-running computations back on chain.
|
||||
///
|
||||
/// NOTE: This function runs off-chain, so it can access the block state,
|
||||
/// but cannot preform any alterations.
|
||||
/// but cannot preform any alterations. More specifically alterations are
|
||||
/// not forbidden, but they are not persisted in any way after the worker
|
||||
/// has finished.
|
||||
#[impl_for_tuples(30)]
|
||||
pub trait OffchainWorker<BlockNumber> {
|
||||
/// This function is being called on every block.
|
||||
/// This function is being called after every block import (when fully synced).
|
||||
///
|
||||
/// Implement this and use special `extern`s to generate transactions or inherents.
|
||||
/// Implement this and use any of the `Offchain` `sp_io` set of APIs
|
||||
/// to perform offchain computations, calls and submit transactions
|
||||
/// with results to trigger any on-chain changes.
|
||||
/// Any state alterations are lost and are not persisted.
|
||||
fn generate_extrinsics(_n: BlockNumber) {}
|
||||
fn offchain_worker(_n: BlockNumber) {}
|
||||
}
|
||||
|
||||
/// Abstraction around hashing
|
||||
|
||||
Reference in New Issue
Block a user