added workaround for cpp getBlock #60000 problem
This commit is contained in:
parent
9b65467586
commit
1373ad9b04
15
lib/node.js
15
lib/node.js
@ -196,8 +196,19 @@ Node.prototype.getBlock = function(number)
|
|||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error("getBlock(" + number + "):", 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;
|
return block;
|
||||||
@ -358,7 +369,7 @@ Node.prototype.getStats = function()
|
|||||||
{
|
{
|
||||||
var block = this.getBlock();
|
var block = this.getBlock();
|
||||||
|
|
||||||
if(block) {
|
if(block.hash !== '?') {
|
||||||
this.stats.block = block;
|
this.stats.block = block;
|
||||||
// Get last MAX_BLOCKS_HISTORY blocks for calculations
|
// Get last MAX_BLOCKS_HISTORY blocks for calculations
|
||||||
if(this.stats.block.number > 0)
|
if(this.stats.block.number > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user