mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-05-06 08:57:58 +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 version: Types.NodeVersion;
|
||||
public config: string;
|
||||
public best = '' as Types.BlockHash;
|
||||
public height = 0 as Types.BlockNumber;
|
||||
public latency = 0 as Types.Milliseconds;
|
||||
public blockTime = 0 as Types.Milliseconds;
|
||||
@@ -125,7 +126,7 @@ export default class Node extends EventEmitter {
|
||||
}
|
||||
|
||||
public blockDetails(): Types.BlockDetails {
|
||||
return [this.height, this.blockTime];
|
||||
return [this.height, this.best, this.blockTime];
|
||||
}
|
||||
|
||||
public get average(): number {
|
||||
@@ -174,6 +175,7 @@ export default class Node extends EventEmitter {
|
||||
if (this.height < height) {
|
||||
const blockTime = this.getBlockTime(time);
|
||||
|
||||
this.best = best;
|
||||
this.height = height;
|
||||
this.lastBlockAt = time;
|
||||
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 TransactionCount = Opaque<number, 'TransactionCount'>;
|
||||
|
||||
export type BlockDetails = [BlockNumber, Milliseconds];
|
||||
export type BlockDetails = [BlockNumber, BlockHash, Milliseconds];
|
||||
export type NodeDetails = [NodeName, NodeImplementation, NodeVersion];
|
||||
export type NodeStats = [PeerCount, TransactionCount];
|
||||
|
||||
|
||||
@@ -36,14 +36,14 @@ export default class App extends React.Component<{}, State> {
|
||||
<table>
|
||||
<thead>
|
||||
<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>
|
||||
</thead>
|
||||
<tbody>
|
||||
{
|
||||
this.nodes().map(([ id, node ]) => {
|
||||
const [name, implementation, version] = node.nodeDetails;
|
||||
const [height, blockTime] = node.blockDetails;
|
||||
const [height, hash, blockTime] = node.blockDetails;
|
||||
const [peers, txcount] = node.nodeStats;
|
||||
|
||||
return (
|
||||
@@ -52,7 +52,7 @@ export default class App extends React.Component<{}, State> {
|
||||
<td>{implementation} v{version}</td>
|
||||
<td>{peers}</td>
|
||||
<td>{txcount}</td>
|
||||
<td>{height}</td>
|
||||
<td>{height} {hash}</td>
|
||||
<td>{blockTime / 1000}s</td>
|
||||
</tr>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user