[RPC][Mining] Add ability to switch between mining algorithms without restarting wallet#878
Merged
codeofalltrades merged 3 commits intoVeil-Project:masterfrom Dec 10, 2020
Merged
Conversation
This was referenced Dec 6, 2020
Collaborator
|
This worked nicely in my test of #879 incorporating this. |
codeofalltrades
added a commit
that referenced
this pull request
Dec 10, 2020
6cc4d59 [RPC][Mining] Add sanity checks to generatecontinuous (Cave Spectre) Pull request description: ### Note This is built on top of #878 and requires code added in #877 and #878 ### Problem `generatecontinuous` can get users in trouble by not knowing what their settings will do to their resources ### Solution Add checks in `generatecontinuous`: - Warn if RandomX is set to less than 4 threads. - Warn if Sha256D is more than one thread less than the number of cores - Provide ability to override the warnings with a new optional parameter - Disallow generatecontinuous true if already running - Rework the result of the command to provide a JSON status ### Testing ``` $ veil-cli generatecontinuous true 1 { "success": true, "algorithm": "sha256d", "threads": 1, "message": "Mining started" } $ veil-cli generatecontinuous true 1 error code: -32603 error message: Mining already active $ veil-cli generatecontinuous false { "success": true, "algorithm": "sha256d", "threads": 0, "message": "Mining stopped" } ``` ``` $ ./veil-cli setminingalgo randomx { "success": true, "message": "Mining algorithm changed from sha256d to randomx" } $ veil-cli generatecontinuous true 1 error code: -8 error message: Error: RandomX must be at least 4 threads ``` ``` $ veil-cli setminingalgo sha256d { "success": true, "message": "Mining algorithm changed from randomx to sha256d" } $ veil-cli generatecontinuous true 100 error code: -8 error message: Error: Available cores: 4, limit sha256d to 3 threads $ ./veil-cli generatecontinuous true 4 true { "success": true, "algorithm": "sha256d", "threads": 4, "message": "Warning: Available cores: 4, limit sha256d to 3 threads ``` Tree-SHA512: 01bb9d485cb7d382a4cbca6fa89424cb59bd320e50cf3364397bf0d246b6a862d48616425a9bf6960dbed50fb164a96611c208e35c9ed8878bbe80f4b1f7a5de
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Note
This is built on top of #876 and also contains a couple corrections to get the
getnetworkhashpshelp.Problem
In order to switch mining algorithms, you must shut down the wallet and restart with a new
-mine=flag.Root Cause
Never implemented
Solution
Add
setminingalgocli command to allow you to switch between different algorithms. This RPC command requires you to turn off mining before issuing the command and will error if it does not work.Testing