Switch vardiff.mode to safe by default.

This commit is contained in:
Matt 2014-02-26 21:21:41 -07:00
parent 5b0c39e840
commit 79c1a95b59
3 changed files with 16 additions and 13 deletions

View File

@ -126,9 +126,12 @@ var pool = stratum.createPool({
retargetTime: 120, //check to see if we should retarget every this many seconds
variancePercent: 20 //allow average time to very this % from target without retarget
/* Enabling this option will queue client difficulty updates to be sent when a new job
is available. Otherwise new difficulties will be sent immediately. */
//mode: 'safe'
/* By default new difficulties will be sent when a new job is available as stratum
protocol (http://mining.bitcoin.cz/stratum-mining) states that new difficulties
"will be applied to every next job received from the server." Some miner software
will almost immediately apply new difficulties. Set mode to fast for difficulty
to be sent immediately. */
//mode: 'fast'
}
}, function(ip, workerName, password, callback){ //stratum authorization function

View File

@ -48,7 +48,7 @@ var BlockTemplate = module.exports = function BlockTemplate(jobId, rpcData, publ
}));
this.merkleTree = new merkleTree(getTransactionBuffers(rpcData.transactions));
this.merkleBranch = getMerkleHashes(this.merkleTree.steps);
this.generationTransaction = transactions.CreateGeneration(//new transactions.Generation(
this.generationTransaction = transactions.CreateGeneration(
rpcData,
publicKey,
extraNoncePlaceholder,

View File

@ -66,20 +66,20 @@ var pool = module.exports = function pool(options, authorizeFn){
_this.varDiff = new varDiff(options.varDiff, options.difficulty);
_this.varDiff.on('newDifficulty', function(client, newDiff) {
if (options.varDiff.mode === 'safe'){
/* We request to set the newDiff @ the next difficulty retarget
(which should happen when a new job comes in - AKA BLOCK) */
client.enqueueNextDifficulty(newDiff);
}
else{
if (options.varDiff.mode === 'fast'){
/* Send new difficulty, then force miner to use new diff by resending the
current job parameters but with the "clean jobs" flag set to false
so the miner doesn't restart work and submit duplicate shares */
current job parameters but with the "clean jobs" flag set to false
so the miner doesn't restart work and submit duplicate shares */
client.sendDifficulty(newDiff);
var job = _this.jobManager.currentJob.getJobParams();
//job[8] = false;
job[8] = false;
client.sendMiningJob(job);
}
else{
/* We request to set the newDiff @ the next difficulty retarget
(which should happen when a new job comes in - AKA BLOCK) */
client.enqueueNextDifficulty(newDiff);
}
});
emitLog("system", "VarDiff enabled and setup");
}