Fixed nTime check. We were comparing the nTime(hex) with an int. So string comparison were going on!

This commit is contained in:
Andrea Baccega 2014-02-20 00:09:15 +01:00
parent 90bdc9a250
commit 04ddb472ee
2 changed files with 4 additions and 4 deletions

View File

@ -17,10 +17,10 @@ var blockTemplate = require('./blockTemplate.js');
var ExtraNonceCounter = function(){
var instanceId = 31;
var counter = instanceId << 27;
var size = util.packUInt32BE(counter).length;
var size = util.packUInt32BE(Math.abs(counter)).length;
this.next = function(){
var extraNonce = util.packUInt32BE(counter++);
var extraNonce = util.packUInt32BE(Math.abs(counter++));
return extraNonce.toString('hex');
};
this.size = function(){
@ -152,7 +152,7 @@ var JobManager = module.exports = function JobManager(options){
};
this.processShare = function(jobId, difficulty, extraNonce1, extraNonce2, nTime, nonce, ipAddress, workerName){
console.log(difficulty);
var shareError = function(error){
_this.emit('share', {
job: jobId,
@ -181,7 +181,7 @@ var JobManager = module.exports = function JobManager(options){
}
var nTimeInt = parseInt(nTime, 16);
if (nTimeInt < job.rpcData.curtime || nTime > submitTime + 7200) {
if (nTimeInt < job.rpcData.curtime || nTimeInt > submitTime + 7200) {
return shareError([20, 'ntime out of range']);
}

0
scripts/blockNotify.js Normal file → Executable file
View File