Browse Source

Update stratum.go

With the provided code snippet, the getNotificationResponse function will now include additional logic to handle the "mining.notify" response differently based on the stratum mode. For regular stratum mode (EthProxy), it will return the initial response with "EthereumStratum/1.0.0" and the extranonce. For NiceHash stratum mode, it will construct the response using data from the current block template (t) and return the appropriate response for NiceHash miners.

Please note that the getNotificationResponse function is used in the handleTCPMessage function when handling "mining.subscribe" requests for NiceHash mode. Make sure the rest of the code is properly set up to handle NiceHash stratum mode based on your specific requirements.

Remember to integrate this code into your existing Go codebase and test it thoroughly to ensure it works as expected. If you have any further questions or need additional assistance, feel free to ask!
master
yuriy0803 2 years ago committed by GitHub
parent
commit
a44de4c59f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      proxy/stratum.go

21
proxy/stratum.go

@ -640,5 +640,26 @@ func (cs *Session) getNotificationResponse(s *ProxyServer) interface{} {
result[0] = []string{"mining.notify", randomHex(16), "EthereumStratum/1.0.0"} result[0] = []string{"mining.notify", randomHex(16), "EthereumStratum/1.0.0"}
result[1] = cs.Extranonce result[1] = cs.Extranonce
// Additional response data for NiceHash stratum mode
if cs.stratumMode() == NiceHash {
t := s.currentBlockTemplate()
if t != nil {
// Construct the response for NiceHash "mining.notify"
jobID := randomHex(8)
seedHash := t.Seed
headerHash := t.Header
height := util.ToHex1(int64(t.Height))
// TO DO: Clean up the response structure based on actual data in "t"
result = []interface{}{
"mining.notify",
jobID,
seedHash,
headerHash,
height,
}
}
}
return result return result
} }

Loading…
Cancel
Save