Added txRefreshInterval
This commit is contained in:
parent
98d3dcc532
commit
50c8fb7c1b
@ -89,6 +89,11 @@ var pool = Stratum.createPool({
|
||||
|
||||
"address": "mi4iBXbBsydtcc5yFmsff2zCFVX4XG7qJc", //Address to where block rewards are given
|
||||
"blockRefreshInterval": 1000, //How often to poll RPC daemons for new blocks, in milliseconds
|
||||
|
||||
/* How many milliseconds should have passed before new block transactions will trigger a new
|
||||
job broadcast. */
|
||||
"txRefreshInterval": 20000,
|
||||
|
||||
//instanceId: 37, //Recommend not using this because a crypto-random one will be generated
|
||||
|
||||
/* Some attackers will create thousands of workers that use up all available socket connections,
|
||||
|
||||
@ -132,6 +132,8 @@ var JobManager = module.exports = function JobManager(options){
|
||||
this.currentJob;
|
||||
this.validJobs = {};
|
||||
|
||||
var lastTransactionUpdateCheck = Date.now();
|
||||
|
||||
//returns true if processed a new block
|
||||
this.processTemplate = function(rpcData, publicKey){
|
||||
|
||||
@ -151,6 +153,12 @@ var JobManager = module.exports = function JobManager(options){
|
||||
(_this.currentJob.rpcData.transactions.length != rpcData.transactions.length)
|
||||
|
||||
|
||||
if (updatedTransactions && (Date.now() - lastTransactionUpdateCheck >= options.txRefreshInterval)){
|
||||
lastTransactionUpdateCheck = Date.now();
|
||||
}
|
||||
else
|
||||
updatedTransactions = false;
|
||||
|
||||
//Update current job if new block or new transactions
|
||||
if (isNewBlock || updatedTransactions){
|
||||
|
||||
|
||||
@ -123,7 +123,8 @@ var pool = module.exports = function pool(options, authorizeFn){
|
||||
address : options.address,
|
||||
algorithm : options.coin.algorithm,
|
||||
reward : options.coin.reward,
|
||||
txMessages: options.coin.txMessages
|
||||
txMessages: options.coin.txMessages,
|
||||
txRefreshInterval: options.txRefreshInterval
|
||||
});
|
||||
_this.jobManager.on('newBlock', function(blockTemplate){
|
||||
//Check if stratumServer has been initialized yet
|
||||
|
||||
Loading…
Reference in New Issue
Block a user