Skip to content

Update for BLAKE2b difficulty units - #22

Open
luke-jr wants to merge 5 commits into
CONVOYMining:masterfrom
luke-jr:diff_b2b
Open

luke-jr wants to merge 5 commits into
CONVOYMining:masterfrom
luke-jr:diff_b2b

Conversation

@luke-jr

@luke-jr luke-jr commented Oct 1, 2026

Copy link
Copy Markdown

No description provided.

@luke-jr luke-jr added this to the 0.5.0 milestone Oct 1, 2026
@luke-jr
luke-jr requested a balanced review from Copilot October 1, 2026 07:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Two undefined-behavior cases in configuration parsing and tests must be corrected.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Updates user-facing values and configuration to use BLAKE2b difficulty units while retaining internal p-difficulty accounting.

Changes:

  • Adds difficulty conversion, formatting, and network calculation utilities.
  • Supports SI-suffixed difficulty configuration and display.
  • Caps vardiff growth and validates pool-provided minimums.
File Description
src/​datum_utils.h Declares difficulty types and helpers.
src/​datum_utils.c Implements calculation and SI formatting.
src/​datum_utils_tests.c Tests difficulty utilities.
src/​datum_stratum.c Caps vardiff growth safely.
src/​datum_protocol.c Normalizes and displays pool difficulty.
src/​datum_protocol_tests.c Tests pool difficulty boundaries.
src/​datum_conf.h Adds the difficulty configuration type.
src/​datum_conf.c Parses and emits difficulty values.
src/​datum_conf_tests.c Tests difficulty parsing.
src/​datum_api.c Displays converted difficulty values.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/datum_conf_tests.c
static void datum_conf_test_difficulty_(json_t * const input, const int expected_ret, const int expected_pdiff,
const char * const expr, const unsigned int line, const char * const func) {
assert(input);
const char err[0x100];
Comment thread src/datum_conf.c
long double rounding_unit;
if (end[0]) {
static const char suffixes[] = "KMGTPEZYRQ";
const char * const suffix = strchr(suffixes, toupper(end[0]));
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