Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Randomize (and limit) mining jobs #65

Closed
wants to merge 1 commit into from

Conversation

killerwhile
Copy link
Member

This MR is a test to make this mining pool ASIC compatible. The first change is to randomize the mining jobs sent to the miners, because there are some miners which only mine the first job returned, and this one is at the very moment always on chain 0->0.

_this.validJobs.addJobs(miningJobs, now);
_this.emit('newJobs', miningJobs);
// randomize and limit miningJobs
randomizedMiningJobs = miningJobs.map(value => ({ value, sort: Math.random() }))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
randomizedMiningJobs = miningJobs.map(value => ({ value, sort: Math.random() }))
var randomizedMiningJobs = miningJobs.map(value => ({ value, sort: Math.random() }))

randomizedMiningJobs = miningJobs.map(value => ({ value, sort: Math.random() }))
.sort((a, b) => a.sort - b.sort)
.map(({ value }) => value)
.slice(0,3)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.slice(0,3)
.slice(0, 3)

randomizedMiningJobs = miningJobs.map(value => ({ value, sort: Math.random() }))
.sort((a, b) => a.sort - b.sort)
.map(({ value }) => value)
.slice(0,3)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How exactly was the limit of 3 chosen ?

@polarker
Copy link
Member

This feature has been implemented and merged. Please check the merged PR here: #67

@polarker polarker closed this Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants