mining: Wait for initial sync to generate template.
mining: Wait for initial sync to generate template.

Currently, when the server is started with a chain that is already
synced, a new block template will not be generated until either a new
template is forced to be generated via the regentemplate RPC or a new
block is connected.

In practice, the most observable consequence is that getwork won't
return results right away when restarting the server when the chain is
already synced until either of the aforementioned cases happened which
makes it appear as if it is hung.

This resolves that by modifying the logic of the background block
template generator to wait for the initial chain sync to complete prior
to attempting to generate the first template unless unsynced mining is
allowed.

decred/dcrd,decred/dcrd