Merge pull request #59 from cubedro/develop

Added initBlockHistory
This commit is contained in:
Marian OANCΞA 2015-04-08 22:31:16 +03:00
commit 4698a92109
1 changed files with 14 additions and 0 deletions

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')