Skip to content

Commit

Permalink
Ntime for jobs (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubtrnka committed Oct 25, 2022
1 parent 21991c1 commit 0c161fe
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 28 deletions.
7 changes: 5 additions & 2 deletions 03-Protocol-Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ Multibyte data types are always serialized as little-endian.
| | | dropped from the SipHash output to make it 6 bytes. TX_ID is 32 |
| | | byte transaction id and k0 and k1 are U64 siphash keys. |
+---------------+---------------------------------+--------------------------------------------------------------------+
| OPTION[T] | 1 + occupied ? size(T) : 0 | Alias for SEQ0_1[T]. Identical representation to SEQ0_255 but |
| | | enforces the maximum size of 1
+---------------+---------------------------------+--------------------------------------------------------------------+
| SEQ0_255[T] | Fixed size T: | 1-byte length L, unsigned integer 8-bits, followed by a sequence |
| | 1 + LENGTH * size(T) | of L elements of type T. Allowed range of length is 0 to 255. |
| | Variable length T: | |
Expand Down Expand Up @@ -374,9 +377,9 @@ However, they MUST always set vendor to a string describing the manufacturer/dev
| | | 2 = Template Distribution Protocol |
| | | 3 = Job Distribution Protocol |
+------------------+-----------+----------------------------------------------------------------------------------------+
| min_version | U16 | The minimum protocol version the client supports (currently must be 2) |
| min_version | U16 | The minimum protocol version the client supports (currently must be 3) |
+------------------+-----------+----------------------------------------------------------------------------------------+
| max_version | U16 | The maximum protocol version the client supports (currently must be 2) |
| max_version | U16 | The maximum protocol version the client supports (currently must be 3) |
+------------------+-----------+----------------------------------------------------------------------------------------+
| flags | U32 | Flags indicating optional protocol features the client supports. Each protocol from |
| | | protocol field as its own values/flags. |
Expand Down
45 changes: 22 additions & 23 deletions 04-Mining-Protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,25 +407,24 @@ The server provides an updated mining job to the client through a standard chann
If the `future_job` field is set to False, the client MUST start to mine on the new job as soon as possible after receiving this message.

```
+-------------+-----------+--------------------------------------------------------------------------------------------+
| Field Name | Data Type | Description |
+-------------+-----------+--------------------------------------------------------------------------------------------+
| channel_id | U32 | Channel identifier, this must be a standard channel |
+-------------+-----------+--------------------------------------------------------------------------------------------+
| job_id | U32 | Identifier of the job as provided by NewMiningJob or NewExtendedMiningJob message |
+-------------+-----------+--------------------------------------------------------------------------------------------+
| future_job | BOOL | True if the job is intended for a future SetNewPrevHash message sent on this channel. If |
| | | False, the job relates to the last sent SetNewPrevHash message on the channel and the |
| | | miner should start to work on the job immediately. |
+-------------+-----------+--------------------------------------------------------------------------------------------+
| <The following variables are Bitcoin-specific> |
+-------------+-----------+--------------------------------------------------------------------------------------------+
| version | U32 | Valid version field that reflects the current network consensus. The general purpose bits |
| | | (as specified in BIP320) can be freely manipulated by the downstream node. The downstream |
| | | node MUST NOT rely on the upstream node to set the BIP320 bits to any particular value. |
+-------------+-----------+--------------------------------------------------------------------------------------------+
| merkle_root | B32 | Merkle root field as used in the bitcoin block header |
+-------------+-----------+--------------------------------------------------------------------------------------------+
+----------------+---------------+-------------------------------------------------------------------------------------+
| Field Name | Data Type | Description |
+----------------+---------------+-------------------------------------------------------------------------------------+
| channel_id | U32 | Channel identifier, this must be a standard channel |
+----------------+---------------+-------------------------------------------------------------------------------------+
| job_id | U32 | Identifier of the job as provided by NewMiningJob or NewExtendedMiningJob message |
+----------------+---------------+-------------------------------------------------------------------------------------+
| min_ntime | OPTION[u32] | Empty if the job is intended for a future SetNewPrevHash message sent on this |
| | | channel. Filled with min_ntime if the job is intended to the last sent |
| | | SetNewPrevHash message and the miner should start to work on the job immediately. |
+----------------+---------------+-------------------------------------------------------------------------------------+
| version | U32 | Valid version field that reflects the current network consensus. The general |
| | | purpose bits (as specified in BIP320) can be freely manipulated by the downstream |
| | | node. The downstream node MUST NOT rely on the upstream node to set the BIP320 bits |
| | | to any particular value. |
+----------------+---------------+-------------------------------------------------------------------------------------+
| merkle_root | B32 | Merkle root field as used in the bitcoin block header |
+----------------+---------------+-------------------------------------------------------------------------------------+
```


Expand Down Expand Up @@ -454,10 +453,10 @@ A proxy MUST translate the message for all downstream channels belonging to the
+-------------------------+----------------+---------------------------------------------------------------------------+
| job_id | U32 | Server’s identification of the mining job |
+-------------------------+----------------+---------------------------------------------------------------------------+
| future_job | BOOL | True if the job is intended for a future SetNewPrevHash message sent on |
| | | this channel. If False, the job relates to the last sent SetNewPrevHash |
| | | message on the channel and the miner should start to work on the job |
| | | immediately. |
| min_ntime | OPTION[u32] | Empty if the job is intended for a future SetNewPrevHash message sent on |
| | | this channel. Filled with min_ntime if the job is intended to the last |
| | | sent SetNewPrevHash message on the channel and the miner should start to |
| | | work on the job immediately. |
+-------------------------+----------------+---------------------------------------------------------------------------+
| version | U32 | Valid version field that reflects the current network consensus |
+-------------------------+----------------+---------------------------------------------------------------------------+
Expand Down
6 changes: 3 additions & 3 deletions 07-Message-Types.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
+----------------------+-----------------+-----------------------------------------------------------------------------+
| 0x11 | 0 | OpenStandardMiningChannel.Success |
+----------------------+-----------------+-----------------------------------------------------------------------------+
| 0x12 | 0 | OpenStandardMiningChannel.Error |
| 0x12 | 0 | OpenMiningChannel.Error |
+----------------------+-----------------+-----------------------------------------------------------------------------+
| 0x13 | 0 | OpenExtendedMiningChannel |
+----------------------+-----------------+-----------------------------------------------------------------------------+
| 0x14 | 0 | OpenExtendedMiningChannel.Success |
+----------------------+-----------------+-----------------------------------------------------------------------------+
| 0x15 | 0 | OpenExtendedMiningChannel.Error |
| 0x15 | 0 | NewMiningJob |
+----------------------+-----------------+-----------------------------------------------------------------------------+
| 0x16 | 1 | UpdateChannel |
+----------------------+-----------------+-----------------------------------------------------------------------------+
Expand All @@ -42,7 +42,7 @@
+----------------------+-----------------+-----------------------------------------------------------------------------+
| 0x1d | 1 | SubmitShares.Error |
+----------------------+-----------------+-----------------------------------------------------------------------------+
| 0x1e | 1 | NewMiningJob |
| 0x1e | 1 | Reserved |
+----------------------+-----------------+-----------------------------------------------------------------------------+
| 0x1f | 1 | NewExtendedMiningJob |
+----------------------+-----------------+-----------------------------------------------------------------------------+
Expand Down

0 comments on commit 0c161fe

Please sign in to comment.