added block arrival time and propagation time
This commit is contained in:
parent
f3fdabf0be
commit
b7ce4ddf2b
@ -137,7 +137,8 @@ Node.prototype.getBlock = function(number)
|
|||||||
number: 0,
|
number: 0,
|
||||||
hash: '?',
|
hash: '?',
|
||||||
difficulty: 0,
|
difficulty: 0,
|
||||||
timestamp: 0
|
timestamp: 0,
|
||||||
|
arrival: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
if(typeof number === 'undefined'){
|
if(typeof number === 'undefined'){
|
||||||
@ -157,6 +158,8 @@ Node.prototype.getBlock = function(number)
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
block = web3.eth.block(number);
|
block = web3.eth.block(number);
|
||||||
|
block.arrival = Math.floor(Date.now()/1000);
|
||||||
|
block.propagation = block.arrival - block.timestamp;
|
||||||
|
|
||||||
if(block.hash != '?' && typeof block.difficulty !== 'undefined')
|
if(block.hash != '?' && typeof block.difficulty !== 'undefined')
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user