Fixed bug where block was not being reported as found when it actually was

This commit is contained in:
Matt 2014-02-26 22:56:47 -07:00
parent 57f8dc3ffa
commit 0f38fd5549
2 changed files with 7 additions and 20 deletions

View File

@ -376,10 +376,11 @@ var pool = module.exports = function pool(options, authorizeFn){
function CheckBlockAccepted(blockHash, callback){
_this.daemon.cmd('getblock',
[blockHash],
function(error, result){
if (error)
function(error, results){
if (error){
callback(false);
else if (result.hash === blockHash)
}
else if (results.filter(function(result){return result.hash === blockHash}).length >= 1)
callback(true);
else
callback(false);
@ -387,6 +388,7 @@ var pool = module.exports = function pool(options, authorizeFn){
);
}
/**
* This method is being called from the blockNotify so that when a new block is discovered by the daemon
* We can inform our miners about the newly found block

View File

@ -195,16 +195,8 @@ var StratumClient = function(options){
}
this.enqueueNextDifficulty = function(requestedNewDifficulty) {
if (typeof(requestedNewDifficulty) != 'number') {
console.error('[StratumClient.enqueueNextDifficulty] given difficulty parameter is not a number: ['+requestedNewDifficulty+']');
return false;
} else {
console.log('[StratumClient.enqueueNextDifficulty] next difficulty should be: ['+requestedNewDifficulty+']');
pendingDifficulty = requestedNewDifficulty;
return true;
}
pendingDifficulty = requestedNewDifficulty;
return true;
};
//public members
@ -214,11 +206,6 @@ var StratumClient = function(options){
* returns boolean
**/
this.sendDifficulty = function(difficulty){
if (typeof(difficulty) != 'number') {
console.error('[StratumClient.sendDifficulty] given difficulty parameter is not a number: ['+difficulty+']');
return false;
}
if (difficulty === this.difficulty)
return false;
@ -229,8 +216,6 @@ var StratumClient = function(options){
params: [difficulty]//[512],
});
return true;
};
this.sendMiningJob = function(jobParams){