added initBlockHistory

This commit is contained in:
cubedro 2015-04-07 20:02:17 +03:00
parent 11008d51ee
commit 925201c8f4

View File

@ -37,6 +37,8 @@ var Node = function Node(data)
history: []
};
this.initBlockHistory();
if(this.id === null) {
this.uptime.started = (new Date()).getTime();
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};
}
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)
{
if(typeof stats !== 'undefined' && typeof stats.block !== 'undefined' && typeof stats.block.number !== 'undefined')