multi: Add tpl update reason to work ntfns. #1923
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This updates the new RPC websocket
work
notification that is sent when a new template is generated and a websocket client requests updated vianotifywork
to include the reason the template was generated.The text-based reasons delivered via the
work
notification are:newparent
-- The template builds on a new block as compared to the previous one.newvotes
-- A new vote for the block the template builds on has been received.newtxns
-- New non-vote transactions are available and have potentially been included.This allows pools that subscribe for work notifications to better choose when to signal workers to throw away all current work and start working on a new template immediately. In particular, the
newparent
andnewvotes
reasons should trigger workers to immediately switch. On the other hand new work as the result ofnewtxns
is something that pools will likely want to allow workers to opportunistically switch to after completing a a work cycle.It is also important to note that miners should roll time timestamps as they work on templates in between updates to keep the timestamps as close to accurate as possible.
This consists of two commits to make the review easier.
The first commit exports the template update reason type and associated constants in preparation to modify the template notifications to include the reason a new block template was generated.
The second commit modifies the background template generator subscription notifications, the RPC websockets notification manager, and the JSON-RPC work notification to include the reason and updates all of the intermediate plumbing code accordingly.
It also updates the JSON-RPC documentation to include the new field and enumerate the supported reasons.