Skip to content

refactor(channels-sv2): Update share validation result with share metadata#1965

Closed
average-gary wants to merge 2 commits into
stratum-mining:mainfrom
average-gary:validate-share-refactor
Closed

refactor(channels-sv2): Update share validation result with share metadata#1965
average-gary wants to merge 2 commits into
stratum-mining:mainfrom
average-gary:validate-share-refactor

Conversation

@average-gary
Copy link
Copy Markdown
Contributor

  • Modify ShareValidationResult enum to include share_work and share_hash for both Valid and BlockFound variants
  • Update share validation logic in extended.rs, standard.rs to pass share metadata

Minimal returned data from validate_share() to enable application side handling. i.e. Persistence.

…adata

- Modify `ShareValidationResult` enum to include `share_work` and `share_hash` for both `Valid` and `BlockFound` variants
- Update share validation logic in `extended.rs`, `standard.rs` to pass share metadata
@average-gary average-gary marked this pull request as ready for review October 24, 2025 15:22
Comment on lines +54 to +57
acknowledgement: bool,
last_sequence_number: u32,
new_submits_accepted_count: u32,
new_shares_sum: u64,
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.

all of this can be achieved in the application layer by calling get_share_accounting

/// - `new_submits_accepted_count`: The number of new shares accepted in this batch
/// - `new_shares_sum`: The total work contributed by shares in this batch
Valid {
share_work: f64,
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.

this can be retrieved in the application layer by calling get_target

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.

format!("{:x}", network_target)
);

let share_work = self.target.difficulty_float();
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.

.

@average-gary average-gary deleted the validate-share-refactor branch October 24, 2025 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants