I'm online Module

If the local node is a validator (i.e. contains an authority key), this module gossips a heartbeat transaction with each new session. The heartbeat functions as a simple mechanism to signal that the node is online in the current era.

Received heartbeats are tracked for one era and reset with each new era. The module exposes two public functions to query if a heartbeat has been received in the current era or session.

The heartbeat is a signed transaction, which was signed using the session key and includes the recent best block number of the local validators chain as well as the NetworkState. It is submitted as an Unsigned Transaction via off-chain workers.

Interface

Public Functions

Usage

```rust use framesupport::{declmodule, dispatch}; use framesystem::ensuresigned; use palletimonline::{self as im_online};

pub trait Trait: im_online::Trait {}

declmodule! { pub struct Module for enum Call where origin: T::Origin { #[weight = 0] pub fn isonline(origin, authorityindex: u32) -> dispatch::DispatchResult { let _sender = ensuresigned(origin)?; let isonline = >::isonline(authorityindex); Ok(()) } } } ```

Dependencies

This module depends on the Session module.

License: Apache-2.0