Skip to content

Commit b486ac4

Browse files
authored
Merge pull request #146 from plebhash/2025-08-05-clarify-tdp
clarify description of `SetNewPrevHash` of Template Distribution Protocol
2 parents 3a738d7 + f42a9b6 commit b486ac4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

07-Template-Distribution-Protocol.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,12 @@ Please note that differently from `SetCustomMiningJob.coinbase_tx_outputs` and `
5050
## 7.3 `SetNewPrevHash` (Server -> Client)
5151

5252
Upon successful validation of a new best block, the server MUST immediately provide a `SetNewPrevHash` message.
53-
If a `NewMiningJob` message has previously been sent with an empty `min_ntime`, which is valid work based on the `prev_hash` contained in this message, the `template_id` field SHOULD be set to the `job_id` present in that `NewTemplate` message indicating the client MUST begin mining on that template as soon as possible.
5453

55-
TODO: Define how many previous works the client has to track (2? 3?), and require that the server reference one of those in `SetNewPrevHash`.
54+
Prior to that, the server MUST send at least one, but potentially multiple `NewTemplate` messages with `future_template` flag set. The client SHOULD keep track of all of them, and convert them into `NewMiningJob` and `NewExtendedMiningJob` messages (with empty `min_ntime`) in case it's also acting as a server under the Mining Protocol.
55+
56+
If a `NewMiningJob` or `NewExtendedMiningJob` message has previously been sent with an empty `min_ntime`, and it is valid work based on the `prev_hash` contained in this message, the `template_id` field SHOULD be matched to the corresponding `NewTemplate` message that generated the `NewMiningJob` or `NewExtendedMiningJob`, and a Mining Protocol `SetNewPrevHash` message SHOULD be sent indicating the client MUST begin mining on that job as soon as possible.
57+
58+
After that, the future templates that were being kept in memory can be discarded, leaving room for future templates relative to the next `SetNewPrevHash`.
5659

5760
| Field Name | Data Type | Description |
5861
| ---------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

0 commit comments

Comments
 (0)