Merge pull request #77 from cubedro/develop
added workaround for cpp getBlock #60000 problem
This commit is contained in:
commit
3909772333
15
lib/node.js
15
lib/node.js
@ -196,8 +196,19 @@ Node.prototype.getBlock = function(number)
|
||||
}
|
||||
catch (err) {
|
||||
console.error("getBlock(" + number + "):", err);
|
||||
if(number > 0){
|
||||
try {
|
||||
number -= 1;
|
||||
block = web3.eth.getBlock(number, true);
|
||||
|
||||
return false;
|
||||
if(block.hash != '?' && typeof block.difficulty !== 'undefined')
|
||||
{
|
||||
block.difficulty = web3.toDecimal(block.difficulty);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("getBlock(" + number + "):", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return block;
|
||||
@ -358,7 +369,7 @@ Node.prototype.getStats = function()
|
||||
{
|
||||
var block = this.getBlock();
|
||||
|
||||
if(block) {
|
||||
if(block.hash !== '?') {
|
||||
this.stats.block = block;
|
||||
// Get last MAX_BLOCKS_HISTORY blocks for calculations
|
||||
if(this.stats.block.number > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user