Claude/investigate digibyte issue - Fix: getmininginfo difficulty #350
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: getmininginfo difficulty field always returns Groestl difficulty (Issue #346)
Summary
Fixes #346 - The
difficultyfield ingetmininginfoRPC was returning a frozen/incorrect value because it was always querying Groestl's difficulty instead of the current mining algorithm's difficulty.Problem Description
In DigiByte v8.26.1, users reported that the
difficultyfield in thegetmininginfoRPC method displays a frozen value that doesn't update correctly. Thedifficultiesfield (plural) works as expected, but the singulardifficultyfield was broken.Root Cause
During the Bitcoin Core v26.2 merge, the
GetDifficulty()call ingetmininginfolost the algorithm parameter.In v8.22.2 (working):
In v8.26.1 (broken):
Since DigiByte's
GetDifficulty()function signature is:When called with only one parameter,
algodefaults to2(ALGO_GROESTL), causing it to always return Groestl's difficulty regardless of the user's configured mining algorithm.Changes Made
src/rpc/mining.cppminingAlgoparameter to theGetDifficulty()callGetDifficulty(tip)→GetDifficulty(tip, nullptr, miningAlgo)Testing
This fix ensures that:
difficultyfield returns the difficulty for the current mining algorithm (as set by-miningalgo)Test commands:
Impact
Additional Context
This is a regression introduced during the Bitcoin Core v26.2 merge. It highlights the importance of preserving DigiByte-specific multi-algorithm functionality when integrating upstream Bitcoin changes. The
difficultiesfield was unaffected because it explicitly iterates through all algorithms with the correct parameters.Repository:
DigiByte-Core/digibyteBranch:
claude/investigate-digibyte-issue-018eRW2M8brZzweTZpj1e89BTarget:
developCommit: c6f3663
Create PR Link: