Allow large block difficulty, but set it to null for PoA (#152).

This commit is contained in:
Richard Moore 2018-04-05 15:31:31 -04:00
parent 96d420e832
commit 28ddf485ed
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295

@ -92,6 +92,18 @@ function checkNumber(number) {
return utils.bigNumberify(number).toNumber();
}
function checkDifficulty(number) {
var value = utils.bigNumberify(number);
try {
value = value.toNumber();
} catch (error) {
value = null;
}
return value;
}
function checkBoolean(value) {
if (typeof(value) === 'boolean') { return value; }
if (typeof(value) === 'string') {
@ -141,7 +153,7 @@ var formatBlock = {
timestamp: checkNumber,
nonce: allowNull(utils.hexlify),
difficulty: allowNull(checkNumber),
difficulty: checkDifficulty,
gasLimit: utils.bigNumberify,
gasUsed: utils.bigNumberify,