Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const startNonce4096 = taskObject.workrange4096queue.shift();
// if this task run out
if (startNonce4096 === undefined) {
this._taskQueue.shift();
continue;
}
// if this task run to threshold, pull next task
if (taskObject.workrange4096queue.length === this._workrange4096pullThreshold) {
this._pull();
}
const startNonce = startNonce4096 * RANGE;
const endNonce = startNonce + RANGE;
percentTime = new Date();
const result = await this._multiMine(new Nimiq.SerialBuffer(taskObject.header), this._compact, startNonce, endNonce);
percentDuration = new Date() - percentTime;
if (result && taskObject.timeNonce36 === this._timeNonce36) {
Log.i(Miner, `mined a share, timeNonce36 ${taskObject.timeNonce36}, nonce ${result.nonce}`);
this._push(
taskObject.timeNonce36,
result.nonce,
taskObject.index,
);
}
this._currHashrate += RANGE;
if (this._percentX > 0) {
await setTimeoutPromise(percentDuration * this._percentX);
}