Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions sv1/src/methods/client_to_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ impl TryFrom<StandardRequest> for Subscribe<'_> {

#[derive(Debug, Clone)]
pub struct Configure {
extensions: Vec<ConfigureExtension>,
id: u64,
pub extensions: Vec<ConfigureExtension>,
pub id: u64,
}

impl fmt::Display for Configure {
Expand Down Expand Up @@ -679,8 +679,8 @@ impl From<ConfigureExtension> for serde_json::Map<String, Value> {

#[derive(Debug, Clone)]
pub struct VersionRollingParams {
mask: Option<HexU32Be>,
min_bit_count: Option<HexU32Be>,
pub mask: Option<HexU32Be>,
pub min_bit_count: Option<HexU32Be>,
}
Comment on lines 681 to 684

@plebhash plebhash Jul 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

making these fields public means VersionRollingParams can now be instantiated with combinations we currently treat as invalid when parsing.

for example:

VersionRollingParams { mask: None, min_bit_count: Some(HexU32Be(0x10)) }

ConfigureExtension::from_value explicitly rejects this shape ((None, Some(_)) => Err(...)).

so I wonder whether it wouldn't be safer to change the PR approach, while keeping internal values private and exposing getters instead?


impl From<VersionRollingParams> for serde_json::Map<String, Value> {
Expand Down Expand Up @@ -709,13 +709,13 @@ impl From<VersionRollingParams> for serde_json::Map<String, Value> {

#[derive(Debug, Clone)]
pub struct InfoParams {
connection_url: Option<String>,
pub connection_url: Option<String>,
#[allow(dead_code)]
hw_id: Option<String>,
pub hw_id: Option<String>,
#[allow(dead_code)]
hw_version: Option<String>,
pub hw_version: Option<String>,
#[allow(dead_code)]
sw_version: Option<String>,
pub sw_version: Option<String>,
}

impl From<InfoParams> for serde_json::Map<String, Value> {
Expand Down
8 changes: 4 additions & 4 deletions sv1/src/methods/server_to_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ impl TryFrom<Notification> for SetExtranonce<'_> {
#[derive(Debug, Clone)]
/// Server may arbitrarily adjust version mask
pub struct SetVersionMask {
version_mask: HexU32Be,
pub version_mask: HexU32Be,
}

impl fmt::Display for SetVersionMask {
Expand Down Expand Up @@ -329,7 +329,7 @@ impl TryFrom<Notification> for SetVersionMask {
#[derive(Debug, Clone)]
pub struct GeneralResponse {
pub id: u64,
result: bool,
pub result: bool,
}

impl fmt::Display for GeneralResponse {
Expand Down Expand Up @@ -373,7 +373,7 @@ impl TryFrom<&Response> for GeneralResponse {
#[derive(Debug, Clone)]
pub struct Authorize {
pub id: u64,
authorized: bool,
pub authorized: bool,
pub prev_request_name: String,
}

Expand All @@ -400,7 +400,7 @@ impl Authorize {
#[derive(Debug, Clone)]
pub struct Submit {
pub id: u64,
is_ok: bool,
pub is_ok: bool,
}

impl fmt::Display for Submit {
Expand Down
Loading