diff --git a/lib/bcoin/bip70/protobuf.js b/lib/bcoin/bip70/protobuf.js index a077067a..29dac687 100644 --- a/lib/bcoin/bip70/protobuf.js +++ b/lib/bcoin/bip70/protobuf.js @@ -200,7 +200,6 @@ exports.readVarint = function readVarint(data, off) { break; } ch = data[off++]; - assert(size + 1 < 6, 'Number exceeds 2^53-1.'); // Optimization for javascript insanity. switch (size) { case 0: @@ -219,6 +218,8 @@ exports.readVarint = function readVarint(data, off) { size++; } + assert(utils.isSafeInteger(num), 'Number exceeds 2^53-1.'); + return { size: size, value: num }; };