File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ const bignum = require('bignum');
3
3
const blockTemplate = require ( './blockTemplate.js' ) ;
4
4
const constants = require ( './constants.js' ) ;
5
5
const util = require ( './util' ) ;
6
+ const crypto = require ( 'crypto' ) ;
6
7
7
8
//Unique job per new block template
8
9
var JobCounter = function ( ) {
@@ -74,11 +75,10 @@ function JobManager(jobExpiryPeriod){
74
75
75
76
this . processJobs = function ( jobs ) {
76
77
var now = Date . now ( ) ;
77
- var miningJobs = jobs . map ( job => {
78
- var jobId = jobCounter . next ( ) ;
79
- job . jobId = jobId ;
80
- return new blockTemplate ( job , now ) ;
81
- } )
78
+ var jobIndex = crypto . randomInt ( 0 , jobs . length )
79
+ var job = jobs [ jobIndex ]
80
+ job . jobId = jobCounter . next ( )
81
+ var miningJobs = [ new blockTemplate ( job , now ) ]
82
82
_this . validJobs . addJobs ( miningJobs , now ) ;
83
83
_this . emit ( 'newJobs' , miningJobs ) ;
84
84
} ;
You can’t perform that action at this time.
0 commit comments