Repository navigation
Conversation
iohzrd
force-pushed
the
coinbaser-prefetch
branch
from
October 5, 2026 22:50
9b44445 to
99a2871
Compare
…job is published On a new block or an urgent work update, update_stratum_job publishes a JOB_STATE_EMPTY_PLUS job, waits up to 4 s for its empty work to be sent, then publishes a JOB_STATE_FULL_PRIORITY_WAIT_COINBASER job from the same template. The coinbaser request was sent only after the second job was published, so its round trip to the pool did not overlap the empty work send. Miners mine on a coinbase that pays only the pool until the reply is applied. The coinbaser thread now fetches the split for the EMPTY_PLUS job's value and previous block when it sees that job, into a static job. The next FULL_PRIORITY_WAIT_COINBASER job copies it if the value, previous block and DATUM session generation match, and otherwise sends its own request. Each take clears the stored split. The coinbaser thread remains the only sender of coinbaser requests.
iohzrd
force-pushed
the
coinbaser-prefetch
branch
from
October 5, 2026 23:08
99a2871 to
f3aa644
Compare
Author
|
Closing. The prefetch saves at most the shorter of the empty work send time and the round trip to the pool, which is a few milliseconds per block. The case that costs the split is a coinbaser reply that arrives after the 5 s timeout: the reply is discarded and miners keep the pool-only coinbase until the next standard job. That needs a separate change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Replaces the previous version of this PR (99a2871). That version sent the request from the template thread through a pending-request slot shared with the coinbaser thread's fetch. Two requests could be outstanding at once, so a reply could be matched to the wrong request, and an unanswered request blocked later fetches for the same template. This version keeps the coinbaser thread as the only sender and does not change
datum_protocol_coinbaser_fetch.On a new block or an urgent work update,
update_stratum_jobpublishes aJOB_STATE_EMPTY_PLUSjob, waits up to 4 s for its empty work to be sent, then publishes aJOB_STATE_FULL_PRIORITY_WAIT_COINBASERjob from the same template. The coinbaser request was sent only after the second job was published, so its round trip to the pool did not overlap the empty work send. Miners mine on a coinbase that pays only the pool until the reply is applied.datum_coinbaser_prefetch: when the coinbaser thread sees anEMPTY_PLUSjob, it fetches the split for that job's value and previous block into a static job. Skipped unlessdatum_protocol_is_active(), the same condition as a job's own fetch.datum_coinbaser_prefetch_take: the nextFULL_PRIORITY_WAIT_COINBASERjob copies the outputs and coinbaser id if its value, previous block and DATUM session generation match. Otherwise it sends its own request, as before. Each take clears the stored split, so at most one job uses it.datum_protocol_session_generation()returns the session counter, so a split fetched on one session is not used on the next.Unchanged: the reply carries only the value, so a late reply to an earlier request with the same value and a different previous block is accepted, as on master.
Merges without conflicts with #9, #13, #21 and #24 separately, and with #9, #13 and #21 together.
-Wall -Werrorbuild and--testpass on each. With #9, the fetch used here also catches a reply that arrives before the wait starts.