mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-06-15 16:31:03 +00:00
Include block hash
This commit is contained in:
@@ -15,6 +15,7 @@ export default class Node extends EventEmitter {
|
|||||||
public implementation: Types.NodeImplementation;
|
public implementation: Types.NodeImplementation;
|
||||||
public version: Types.NodeVersion;
|
public version: Types.NodeVersion;
|
||||||
public config: string;
|
public config: string;
|
||||||
|
public best = '' as Types.BlockHash;
|
||||||
public height = 0 as Types.BlockNumber;
|
public height = 0 as Types.BlockNumber;
|
||||||
public latency = 0 as Types.Milliseconds;
|
public latency = 0 as Types.Milliseconds;
|
||||||
public blockTime = 0 as Types.Milliseconds;
|
public blockTime = 0 as Types.Milliseconds;
|
||||||
@@ -125,7 +126,7 @@ export default class Node extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public blockDetails(): Types.BlockDetails {
|
public blockDetails(): Types.BlockDetails {
|
||||||
return [this.height, this.blockTime];
|
return [this.height, this.best, this.blockTime];
|
||||||
}
|
}
|
||||||
|
|
||||||
public get average(): number {
|
public get average(): number {
|
||||||
@@ -174,6 +175,7 @@ export default class Node extends EventEmitter {
|
|||||||
if (this.height < height) {
|
if (this.height < height) {
|
||||||
const blockTime = this.getBlockTime(time);
|
const blockTime = this.getBlockTime(time);
|
||||||
|
|
||||||
|
this.best = best;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
this.lastBlockAt = time;
|
this.lastBlockAt = time;
|
||||||
this.blockTimes[height % BLOCK_TIME_HISTORY] = blockTime;
|
this.blockTimes[height % BLOCK_TIME_HISTORY] = blockTime;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export type Milliseconds = Opaque<number, 'Milliseconds'>;
|
|||||||
export type PeerCount = Opaque<number, 'PeerCount'>;
|
export type PeerCount = Opaque<number, 'PeerCount'>;
|
||||||
export type TransactionCount = Opaque<number, 'TransactionCount'>;
|
export type TransactionCount = Opaque<number, 'TransactionCount'>;
|
||||||
|
|
||||||
export type BlockDetails = [BlockNumber, Milliseconds];
|
export type BlockDetails = [BlockNumber, BlockHash, Milliseconds];
|
||||||
export type NodeDetails = [NodeName, NodeImplementation, NodeVersion];
|
export type NodeDetails = [NodeName, NodeImplementation, NodeVersion];
|
||||||
export type NodeStats = [PeerCount, TransactionCount];
|
export type NodeStats = [PeerCount, TransactionCount];
|
||||||
|
|
||||||
|
|||||||
@@ -36,14 +36,14 @@ export default class App extends React.Component<{}, State> {
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Node Name</th><th>Node Type</th><th>Peers</th><th>Transactions</th><th>Block</th><th>Block time</th>
|
<th>Node Name</th><th>Node Type</th><th>Peers</th><th>Transactions</th><th>Last Block</th><th>Block Time</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{
|
{
|
||||||
this.nodes().map(([ id, node ]) => {
|
this.nodes().map(([ id, node ]) => {
|
||||||
const [name, implementation, version] = node.nodeDetails;
|
const [name, implementation, version] = node.nodeDetails;
|
||||||
const [height, blockTime] = node.blockDetails;
|
const [height, hash, blockTime] = node.blockDetails;
|
||||||
const [peers, txcount] = node.nodeStats;
|
const [peers, txcount] = node.nodeStats;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -52,7 +52,7 @@ export default class App extends React.Component<{}, State> {
|
|||||||
<td>{implementation} v{version}</td>
|
<td>{implementation} v{version}</td>
|
||||||
<td>{peers}</td>
|
<td>{peers}</td>
|
||||||
<td>{txcount}</td>
|
<td>{txcount}</td>
|
||||||
<td>{height}</td>
|
<td>{height} {hash}</td>
|
||||||
<td>{blockTime / 1000}s</td>
|
<td>{blockTime / 1000}s</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user