decred / gominer

Go (golang) based GPU miner for Decred.
GNU General Public License v3.0
160 stars 80 forks source link

Rework nonces to allow for stratum support. #219

Closed davecgh closed 12 months ago

davecgh commented 12 months ago

Currently, both the first and second extra nonces are updated on new work and iterations of the mining loop and the first extra nonce uses a per-device byte to ensure unique work is being performed on each device.

However, proper stratum support requires using an extra nonce assigned by the pool for the first nonce as well as respecting a provided length for the second extra nonce.

This paves the way to be able to properly support those semantics by reworking the nonce handling to avoid modifying the first extra nonce during the mining loop, moving the per-device byte to the second extra nonce, and rolling the second extra nonce during mining loop instead.