This commit is contained in:
parent
0e52ac9ef0
commit
37dd25122a
@ -276,14 +276,14 @@ History.prototype.prevMaxBlock = function(number)
|
||||
|
||||
History.prototype.bestBlock = function()
|
||||
{
|
||||
return _.max(this._items, 'height');
|
||||
return _.maxBy(this._items, 'height');
|
||||
}
|
||||
|
||||
History.prototype.bestBlockNumber = function()
|
||||
{
|
||||
var best = this.bestBlock();
|
||||
|
||||
if( !_.isUndefined(best.height) )
|
||||
if( !_.isUndefined(best) && !_.isUndefined(best.height) )
|
||||
return best.height;
|
||||
|
||||
return 0;
|
||||
@ -291,14 +291,14 @@ History.prototype.bestBlockNumber = function()
|
||||
|
||||
History.prototype.worstBlock = function()
|
||||
{
|
||||
return _.min(this._items, 'height');
|
||||
return _.minBy(this._items, 'height');
|
||||
}
|
||||
|
||||
History.prototype.worstBlockNumber = function(trusted)
|
||||
{
|
||||
var worst = this.worstBlock();
|
||||
|
||||
if( !_.isUndefined(worst.height) )
|
||||
if( !_.isUndefined(worst) && !_.isUndefined(worst.height) )
|
||||
return worst.height;
|
||||
|
||||
return 0;
|
||||
@ -335,8 +335,7 @@ History.prototype.getNodePropagation = function(id)
|
||||
}
|
||||
}
|
||||
})
|
||||
.reverse()
|
||||
.value();
|
||||
.reverse();
|
||||
|
||||
return propagation;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user