mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-06-13 10:21:02 +00:00
feat: Add support for system.network_state (#183)
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
|||||||
Message,
|
Message,
|
||||||
BestBlock,
|
BestBlock,
|
||||||
SystemInterval,
|
SystemInterval,
|
||||||
|
SystemNetworkState,
|
||||||
AfgFinalized,
|
AfgFinalized,
|
||||||
AfgReceivedPrecommit,
|
AfgReceivedPrecommit,
|
||||||
AfgReceivedPrevote,
|
AfgReceivedPrevote,
|
||||||
@@ -249,6 +250,10 @@ export default class Node {
|
|||||||
this.onSystemInterval(message);
|
this.onSystemInterval(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message.msg === 'system.network_state') {
|
||||||
|
this.onSystemNetworkState(message);
|
||||||
|
}
|
||||||
|
|
||||||
if (message.msg === 'afg.finalized') {
|
if (message.msg === 'afg.finalized') {
|
||||||
this.onAfgFinalized(message);
|
this.onAfgFinalized(message);
|
||||||
}
|
}
|
||||||
@@ -308,6 +313,10 @@ export default class Node {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onSystemNetworkState(message: SystemNetworkState) {
|
||||||
|
this.networkState = message.state;
|
||||||
|
}
|
||||||
|
|
||||||
public isAuthority(): boolean {
|
public isAuthority(): boolean {
|
||||||
return this.authority;
|
return this.authority;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,11 @@ export interface SystemInterval extends BestBlock {
|
|||||||
finalized_hash: Maybe<Types.BlockHash>;
|
finalized_hash: Maybe<Types.BlockHash>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SystemNetworkState extends MessageBase {
|
||||||
|
msg: 'system.network_state';
|
||||||
|
state: Types.NetworkState;
|
||||||
|
}
|
||||||
|
|
||||||
export interface NodeStart extends BestBlock {
|
export interface NodeStart extends BestBlock {
|
||||||
msg: 'node.start';
|
msg: 'node.start';
|
||||||
}
|
}
|
||||||
@@ -112,6 +117,7 @@ export interface BlockImport extends BestBlock {
|
|||||||
export type Message = MessageBase & (
|
export type Message = MessageBase & (
|
||||||
| SystemConnected
|
| SystemConnected
|
||||||
| SystemInterval
|
| SystemInterval
|
||||||
|
| SystemNetworkState
|
||||||
| NodeStart
|
| NodeStart
|
||||||
| BlockImport
|
| BlockImport
|
||||||
| AfgFinalized
|
| AfgFinalized
|
||||||
|
|||||||
Reference in New Issue
Block a user