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
|
"address": "mi4iBXbBsydtcc5yFmsff2zCFVX4XG7qJc", //Address to where block rewards are given
|
||||||
"blockRefreshInterval": 1000, //How often to poll RPC daemons for new blocks, in milliseconds
|
"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
|
//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,
|
/* 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.currentJob;
|
||||||
this.validJobs = {};
|
this.validJobs = {};
|
||||||
|
|
||||||
|
var lastTransactionUpdateCheck = Date.now();
|
||||||
|
|
||||||
//returns true if processed a new block
|
//returns true if processed a new block
|
||||||
this.processTemplate = function(rpcData, publicKey){
|
this.processTemplate = function(rpcData, publicKey){
|
||||||
|
|
||||||
@ -151,6 +153,12 @@ var JobManager = module.exports = function JobManager(options){
|
|||||||
(_this.currentJob.rpcData.transactions.length != rpcData.transactions.length)
|
(_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
|
//Update current job if new block or new transactions
|
||||||
if (isNewBlock || updatedTransactions){
|
if (isNewBlock || updatedTransactions){
|
||||||
|
|
||||||
|
|||||||
@ -123,7 +123,8 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
address : options.address,
|
address : options.address,
|
||||||
algorithm : options.coin.algorithm,
|
algorithm : options.coin.algorithm,
|
||||||
reward : options.coin.reward,
|
reward : options.coin.reward,
|
||||||
txMessages: options.coin.txMessages
|
txMessages: options.coin.txMessages,
|
||||||
|
txRefreshInterval: options.txRefreshInterval
|
||||||
});
|
});
|
||||||
_this.jobManager.on('newBlock', function(blockTemplate){
|
_this.jobManager.on('newBlock', function(blockTemplate){
|
||||||
//Check if stratumServer has been initialized yet
|
//Check if stratumServer has been initialized yet
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user