commit
b2f92984ee
34
lib/node.js
34
lib/node.js
@ -178,8 +178,7 @@ Node.prototype.getBlock = function(number)
|
||||
number: 0,
|
||||
hash: '?',
|
||||
difficulty: 0,
|
||||
timestamp: 0,
|
||||
arrival: 0
|
||||
timestamp: 0
|
||||
};
|
||||
|
||||
if(typeof number === 'undefined'){
|
||||
@ -200,8 +199,6 @@ Node.prototype.getBlock = function(number)
|
||||
|
||||
try {
|
||||
block = web3.eth.getBlock(number, true);
|
||||
block.arrival = (new Date()).getTime();
|
||||
block.propagation = block.arrival - (block.timestamp * 1000);
|
||||
|
||||
if(block.hash != '?' && typeof block.difficulty !== 'undefined')
|
||||
{
|
||||
@ -497,33 +494,4 @@ Node.prototype.stop = function()
|
||||
web3.reset();
|
||||
}
|
||||
|
||||
function directICAP(address)
|
||||
{
|
||||
if (address[0] != 0)
|
||||
return '';
|
||||
|
||||
var d = toBase36(address);
|
||||
|
||||
while(d.length < 30)
|
||||
d = "0" + d;
|
||||
|
||||
return d;
|
||||
// return iban("XE", d);
|
||||
}
|
||||
|
||||
function toBase36(hex)
|
||||
{
|
||||
var c_alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
var a = hex.length;
|
||||
var ret = '';
|
||||
|
||||
for(; a > 0; a = a/36){
|
||||
ret = c_alphabet[a%36] + ret;
|
||||
console.log('a: ', a);
|
||||
console.log('ret: ', ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
module.exports = Node;
|
Loading…
Reference in New Issue
Block a user