fix restart issue of staking miner (#4073)

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
16 jobs for master in 7 minutes and 58 seconds (queued for 6 seconds)