consensus: fail early on pow check when target > 256 bits.

This commit is contained in:
Christopher Jeffrey 2018-07-04 14:30:18 -07:00
parent 05c38853d7
commit b6d067ec93
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -323,6 +323,9 @@ exports.verifyPOW = function verifyPOW(hash, bits) {
if (target.isNeg() || target.isZero())
return false;
if (target.bitLength() > 256)
return false;
const num = new BN(hash, 'le');
if (num.gt(target))