Fix platform.browser.pow

This commit is contained in:
Kagami Hiiragi 2015-01-11 20:31:26 +03:00
parent e40a40abd0
commit 3804adea7f

View File

@ -70,9 +70,14 @@ exports.pow = function(opts) {
// Check all input params prematurely to not let promise executor or // Check all input params prematurely to not let promise executor or
// worker to fail because of it. // worker to fail because of it.
assert(poolSize > 0, "Pool size is too low"); assert(typeof poolSize === "number", "Bad pool size");
assert(poolSize >= 1, "Pool size is too low");
assert(poolSize <= 1024, "Pool size is too high");
assert(typeof opts.target === "number", "Bad target"); assert(typeof opts.target === "number", "Bad target");
assert(opts.target >= 0, "Target is too low");
assert(opts.target <= 9007199254740991, "Target is too high");
assert(Buffer.isBuffer(opts.initialHash), "Bad initial hash"); assert(Buffer.isBuffer(opts.initialHash), "Bad initial hash");
assert(opts.initialHash.length === 64, "Bad initial hash");
var cancel; var cancel;
var promise = new Promise(function(resolve, reject) { var promise = new Promise(function(resolve, reject) {