Merge branch 'master' of https://github.com/cubedro/eth-netstats
This commit is contained in:
commit
4ca0f384f1
@ -302,9 +302,9 @@ Collection.prototype.canNodeUpdate = function(id)
|
||||
|
||||
if(node.canUpdate())
|
||||
{
|
||||
var diff = this._blockchain.bestBlockNumber() - node.getBlockNumber();
|
||||
var diff = node.getBlockNumber() - this._blockchain.bestBlockNumber();
|
||||
|
||||
return (diff <= 0);
|
||||
return Boolean(diff >= 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -169,7 +169,7 @@ History.prototype.add = function(block, id, trusted, addingHistory)
|
||||
propagTimes: []
|
||||
}
|
||||
|
||||
if( this._items.length === 0 || (this._items.length === MAX_HISTORY && block.number > this.worstBlockNumber() && !addingHistory) || (this._items.length < MAX_HISTORY && block.number < this.bestBlockNumber()) )
|
||||
if( this._items.length === 0 || (this._items.length === MAX_HISTORY && block.number > this.worstBlockNumber()) || (this._items.length < MAX_HISTORY && block.number < this.bestBlockNumber() && addingHistory) )
|
||||
{
|
||||
item.propagTimes.push({
|
||||
node: id,
|
||||
@ -634,7 +634,8 @@ History.prototype.getCharts = function()
|
||||
|
||||
History.prototype.requiresUpdate = function()
|
||||
{
|
||||
return ( this._items.length < MAX_HISTORY && !_.isEmpty(this._items) );
|
||||
// return ( this._items.length < MAX_HISTORY && !_.isEmpty(this._items) );
|
||||
return ( this._items.length < MAX_HISTORY );
|
||||
}
|
||||
|
||||
History.prototype.getHistoryRequestRange = function()
|
||||
|
@ -374,6 +374,9 @@ Node.prototype.getBlockNumber = function()
|
||||
|
||||
Node.prototype.canUpdate = function()
|
||||
{
|
||||
if (this.trusted) {
|
||||
return true;
|
||||
}
|
||||
// return (this.info.canUpdateHistory && this.trusted) || false;
|
||||
return (this.info.canUpdateHistory || (this.stats.syncing === false && this.stats.peers > 0)) || false;
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ var trusted = [
|
||||
'185.37.145.18',
|
||||
'172.31.39.87',
|
||||
'86.120.171.69',
|
||||
'86.123.155.6',
|
||||
'188.24.81.133',
|
||||
'::ffff:127.0.0.1',
|
||||
];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user