mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-06-09 20:21:01 +00:00
Fix propagation time for best block
This commit is contained in:
@@ -80,12 +80,17 @@ export default class Chain {
|
||||
|
||||
private updateBlock(node: Node) {
|
||||
if (node.height > this.height) {
|
||||
// New best block
|
||||
const { height, blockTimestamp } = node;
|
||||
|
||||
if (this.blockTimestamp) {
|
||||
this.updateAverageBlockTime(height, blockTimestamp);
|
||||
}
|
||||
|
||||
for (const otherNode of this.nodes) {
|
||||
node.propagationTime = null;
|
||||
}
|
||||
|
||||
this.height = height;
|
||||
this.blockTimestamp = blockTimestamp;
|
||||
node.propagationTime = 0 as Types.PropagationTime;
|
||||
@@ -94,6 +99,7 @@ export default class Chain {
|
||||
|
||||
console.log(`[${this.label}] New block ${this.height}`);
|
||||
} else if (node.height === this.height) {
|
||||
// Caught up to best block
|
||||
node.propagationTime = (node.blockTimestamp - this.blockTimestamp) as Types.PropagationTime;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user