|
|
|
@ -56,6 +56,20 @@ History.prototype.add = function(block, id, trusted, addingHistory) |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// No fork found => add a new one
|
|
|
|
|
var prevBlock = this.prevMaxBlock(block.number); |
|
|
|
|
|
|
|
|
|
if( prevBlock ) |
|
|
|
|
{ |
|
|
|
|
block.time = Math.max(block.arrived - prevBlock.block.arrived, 0); |
|
|
|
|
|
|
|
|
|
if(block.number < this.bestBlock().height) |
|
|
|
|
block.time = Math.max((block.timestamp - prevBlock.block.timestamp) * 1000, 0); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
block.time = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
forkIndex = historyBlock.forks.push(block) - 1; |
|
|
|
|
historyBlock.forks[forkIndex].fork = forkIndex; |
|
|
|
|
} |
|
|
|
@ -97,6 +111,20 @@ History.prototype.add = function(block, id, trusted, addingHistory) |
|
|
|
|
block.received = historyBlock.propagTimes[propIndex].received; |
|
|
|
|
block.propagation = historyBlock.propagTimes[propIndex].propagation; |
|
|
|
|
|
|
|
|
|
var prevBlock = this.prevMaxBlock(block.number); |
|
|
|
|
|
|
|
|
|
if( prevBlock ) |
|
|
|
|
{ |
|
|
|
|
block.time = Math.max(block.arrived - prevBlock.block.arrived, 0); |
|
|
|
|
|
|
|
|
|
if(block.number < this.bestBlock().height) |
|
|
|
|
block.time = Math.max((block.timestamp - prevBlock.block.timestamp) * 1000, 0); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
block.time = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
forkIndex = historyBlock.forks.push(block) - 1; |
|
|
|
|
historyBlock.forks[forkIndex].fork = forkIndex; |
|
|
|
|
} |
|
|
|
|