First of all: great work you did there!
I discovered a small problem in the block polling process: The call to JobManager.ProcessTemplate -> UpdateCurrentJob modifies the current job which miners might still be working on. This can lead to miners submitting shares which are considered invalid by the pool (as the job changed in between notify and submit). For me it does not make a lot of sense to change the block template as long as the block height does not change (at least with a decent sized mempool). Please rectify this assumption if there is a good reason for updating the template.
An easy fix would be adding an additional condition in SetupBlockPolling:
if gbt != nil {
if gbt.PreviousBlockHash != p.JobManager.CurrentJob.GetBlockTemplate.PreviousBlockHash {
p.JobManager.ProcessTemplate(gbt)
}
}
Another possibility would be to give the job a new id or notify all miners immediately about the new job.
First of all: great work you did there! I discovered a small problem in the block polling process: The call to JobManager.ProcessTemplate -> UpdateCurrentJob modifies the current job which miners might still be working on. This can lead to miners submitting shares which are considered invalid by the pool (as the job changed in between notify and submit). For me it does not make a lot of sense to change the block template as long as the block height does not change (at least with a decent sized mempool). Please rectify this assumption if there is a good reason for updating the template. An easy fix would be adding an additional condition in SetupBlockPolling:
Another possibility would be to give the job a new id or notify all miners immediately about the new job.