commit
4698a92109
@ -37,6 +37,8 @@ var Node = function Node(data)
|
|||||||
history: []
|
history: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.initBlockHistory();
|
||||||
|
|
||||||
if(this.id === null) {
|
if(this.id === null) {
|
||||||
this.uptime.started = (new Date()).getTime();
|
this.uptime.started = (new Date()).getTime();
|
||||||
this.setState(true);
|
this.setState(true);
|
||||||
@ -89,6 +91,18 @@ Node.prototype.getInfo = function()
|
|||||||
return {id: this.id, info: this.info, geo: this.geo, stats: this.stats, history: this.blockHistory};
|
return {id: this.id, info: this.info, geo: this.geo, stats: this.stats, history: this.blockHistory};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Node.prototype.initBlockHistory = function()
|
||||||
|
{
|
||||||
|
for(var i=0; i < MAX_HISTORY; i++)
|
||||||
|
{
|
||||||
|
this.blockHistory.push({
|
||||||
|
number: 0,
|
||||||
|
received: 0,
|
||||||
|
propagation: 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Node.prototype.setStats = function(stats)
|
Node.prototype.setStats = function(stats)
|
||||||
{
|
{
|
||||||
if(typeof stats !== 'undefined' && typeof stats.block !== 'undefined' && typeof stats.block.number !== 'undefined')
|
if(typeof stats !== 'undefined' && typeof stats.block !== 'undefined' && typeof stats.block.number !== 'undefined')
|
||||||
|
Loading…
Reference in New Issue
Block a user