channel_msg bits
stratum-mining/sv2-spec#185 reported some ways in which the spec was setting channel_msg to some messages in an inconsistent way
stratum-mining/sv2-spec#196 is fixing the spec (should be merged before we tackle this issue)
we need to fix it here accordingly:
these should be true
|
pub const CHANNEL_BIT_SET_CUSTOM_MINING_JOB: bool = false; |
|
pub const CHANNEL_BIT_SET_CUSTOM_MINING_JOB_ERROR: bool = false; |
|
pub const CHANNEL_BIT_SET_CUSTOM_MINING_JOB_SUCCESS: bool = false; |
this should be false:
|
pub const CHANNEL_BIT_PUSH_SOLUTION: bool = true; |
PushSolution field ordering
(there's nothing wrong with spec here, SRI is just non-compliant since the beginning)
spec defines the following order for the PushSolution fields:
extranonce
prev_hash
nonce
ntime
nbits
version
while job_declaration_sv2 crate defines the message with ntime vs nonce fields swapped
|
pub struct PushSolution<'decoder> { |
|
/// Full extranonce that forms a valid submission. |
|
pub extranonce: B032<'decoder>, |
|
/// Previous block hash. |
|
pub prev_hash: U256<'decoder>, |
|
/// Contains the time the block was constructed as a Unix timestamp. |
|
pub ntime: u32, |
|
/// Nonce of the block. |
|
pub nonce: u32, |
|
/// The bits field is compact representation of the target at the time the block was mined. |
|
pub nbits: u32, |
|
/// The version field in a Bitcoin header initially indicated protocol rule changes. [`BIP9`] |
|
/// altered its use by turning it into a bit vector for coordinated soft fork signaling. |
|
/// [`BIP320`] further refined its purpose by dedicating 16 bits(starting from 13 to 28) of the |
|
/// version field for general-purpose miner use, ensuring that such usage doesn't interfere |
|
/// with the soft fork signaling mechanism defined by [`BIP9`]. |
|
/// |
|
/// [`BIP9`]: https://en.bitcoin.it/wiki/BIP_0009 |
|
/// [`BIP320`]: https://en.bitcoin.it/wiki/BIP_0320 |
|
pub version: u32, |
|
} |
channel_msgbitsstratum-mining/sv2-spec#185 reported some ways in which the spec was setting
channel_msgto some messages in an inconsistent waystratum-mining/sv2-spec#196 is fixing the spec (should be merged before we tackle this issue)
we need to fix it here accordingly:
these should be
truestratum/sv2/subprotocols/mining/src/lib.rs
Lines 90 to 92 in 6ab03af
this should be
false:stratum/sv2/subprotocols/job-declaration/src/lib.rs
Line 48 in 6ab03af
PushSolutionfield ordering(there's nothing wrong with spec here, SRI is just non-compliant since the beginning)
spec defines the following order for the
PushSolutionfields:extranonceprev_hashnoncentimenbitsversionwhile
job_declaration_sv2crate defines the message withntimevsnoncefields swappedstratum/sv2/subprotocols/job-declaration/src/push_solution.rs
Lines 17 to 37 in 6ab03af