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

Do not disconnect miners when they submit a duplicate shares (unless they trigger a limit) #124

Closed
checksum0 opened this issue Mar 24, 2017 · 1 comment

Comments

@checksum0
Copy link

checksum0 commented Mar 24, 2017

Miners are currently getting disconnect when they submit a duplicate shares, no matter what the limits are. Miners shouldn't get disconnect if they submit a single duplicate share.

Limits are currently getting applied to invalid share, but not to duplicate share where a disconnect is applied immediately.

You can find the code proxy/handlers.go, line 75-78.

if exist {
	log.Printf("Duplicate share from %s@%s %v", login, cs.ip, params)
	return false, &ErrorReply{Code: 22, Message: "Duplicate share"}
}

As shown here https://github.com/sammy007/open-ethereum-pool/blob/master/proxy/stratum.go#L56, if it returns an ErrorReply instead of nil, the client gets disconnected. I suggest adding a limit similar to invalid share found at line 80-87.

if !validShare {
	log.Printf("Invalid share from %s@%s", login, cs.ip)
	// Bad shares limit reached, return error and close
	if !ok {
		return false, &ErrorReply{Code: 23, Message: "Invalid share"}
	}
	return false, nil
}

Disconnecting peers with a single duplicate share currently breaks mining, especially with NiceHash rented hashpower (pay for unused hashrate) or with my own miners (lose hashrate due to disconnect).

I can submit a pull request if you agree with the assessment.

@sammy007
Copy link
Owner

You can adjust whatever you want for yourself. Policy for miners with duplicate share attempts will stay the same here.

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

No branches or pull requests

2 participants