Skip to content

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

Merged
davecgh merged 1 commit intodecred:masterfrom
davecgh:mining_wait_for_initial_sync
Mar 13, 2022
Merged

mining: Wait for initial sync to generate template.#2897
davecgh merged 1 commit intodecred:masterfrom
davecgh:mining_wait_for_initial_sync

Conversation

@davecgh
Copy link
Copy Markdown
Member

@davecgh davecgh commented Mar 9, 2022

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.

@davecgh davecgh added this to the 1.8.0 milestone Mar 9, 2022
@davecgh davecgh force-pushed the mining_wait_for_initial_sync branch from dedea29 to 875b4de Compare March 9, 2022 06:15
Copy link
Copy Markdown
Member

@dajohi dajohi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracking this down.

Copy link
Copy Markdown
Member

@chappjc chappjc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can getwork right away now.

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.
@davecgh davecgh force-pushed the mining_wait_for_initial_sync branch from 875b4de to 5d8df9c Compare March 13, 2022 17:30
@davecgh davecgh merged commit 5d8df9c into decred:master Mar 13, 2022
@davecgh davecgh deleted the mining_wait_for_initial_sync branch March 13, 2022 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants