I want to implement a business logic that needs to know if the node of validators in waiting state are up or not. So for that according to me pallet_im_online
was the best solution (but open to any other solutions). After doing some R&D, I found the function below referenced:
fn is_online_aux(authority_index: AuthIndex, authority: &ValidatorId<T>) -> bool {
let current_session = T::ValidatorSet::session_index();
ReceivedHeartbeats::<T>::contains_key(¤t_session, &authority_index) ||
AuthoredBlocks::<T>::get(¤t_session, authority) != 0
}
From this I understand if an authority-node
is authoring blocks than it is online, or if it does not get the chance to author block it will send a Heartbeat
.
But all the above logic works for only the validators that are in active_set
as I have mentioned in the question also I want this for validators in waiting_set
.
What I have done till now:
- I was able to get the validators in
waiting_set
and when I passed itfn is_online_aux
, it was showing inoffenders_list
instead of giving aHeartbeat
. - Which I find later on that it was getting the list of online validators from
fn on_new_session<'a, I: 'a>(_changed: bool, validators: I, _queued_validators: I)
and using it find if authority node is online or not.
Can someone tell me how to achieve it?