Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ntime for jobs #12

Merged
merged 6 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
47 changes: 24 additions & 23 deletions 04-Mining-Protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,25 +407,26 @@ 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. |
+-------------+-----------+--------------------------------------------------------------------------------------------+
+----------------+---------------+-------------------------------------------------------------------------------------+
| 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 |
+----------------+---------------+-------------------------------------------------------------------------------------+
| starting_ntime | OPTION[u32] | Empty if the job is intended for a future SetNewPrevHash message sent on this |
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer the name min_ntime, but if you don't like that for any reason, starting_ntime is also fine

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was @TheBlueMatt suggestion. I don't have strong opinion on that.

Choose a reason for hiding this comment

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

I thought the discord discussion ended up with min, I could be wrong.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Too many communication channels, because I don't remember talking about this on discord. But whatever, let's keep the the original min_ntime.

| | | 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. |
+----------------+---------------+-------------------------------------------------------------------------------------+
| <Bitcoin specific part> |
+-------------+-----------+--------------------------------------------------------------------------------------------+
| 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 |
+-------------+-----------+--------------------------------------------------------------------------------------------+
+----------------+---------------+-------------------------------------------------------------------------------------+
| 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,11 +455,11 @@ 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. |
+-------------------------+----------------+---------------------------------------------------------------------------+
| starting_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 |
+-------------------------+----------------+---------------------------------------------------------------------------+
| version_rolling_allowed | BOOL | If set to True, the general purpose bits of version (as specified in |
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