Merge pull request #121 from cubedro/develop
Fixed negative block time bug
This commit is contained in:
commit
27b1be1369
@ -71,10 +71,10 @@ History.prototype.add = function(block, id)
|
|||||||
|
|
||||||
if( prevBlock )
|
if( prevBlock )
|
||||||
{
|
{
|
||||||
block.time = block.arrived - prevBlock.block.arrived;
|
block.time = Math.max(block.arrived - prevBlock.block.arrived, 0);
|
||||||
|
|
||||||
if(block.number < this.bestBlock().height)
|
if(block.number < this.bestBlock().height)
|
||||||
block.time = (block.timestamp - prevBlock.block.timestamp) * 1000;
|
block.time = Math.max((block.timestamp - prevBlock.block.timestamp) * 1000, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user