-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #878: [RPC][Mining] Add ability to switch between mining algori…
…thms without restarting wallet 6ed4626 [RPC][Mining] Provide ability to change mining algorithm (Cave Spectre) Pull request description: ### Note This is built on top of #876 and also contains a couple corrections to get the `getnetworkhashps` help. ### 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 `setminingalgo` cli 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 ``` $ veil-cli help setminingalgo setminingalgo algorithm Changes your mining algorithm to [algorithm]. Note that mining must be turned off when command is used. Arguments: 1. algorithm (string, required) Algorithm to mine [progpow, randomx, sha256d]. Result: { "success": true|false, (boolean) Status of the switch "message": "text", (text) Informational message about the switch } Examples: > veil-cli setminingalgo sha256d > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "setminingalgo", "params": [sha256d] }' -H 'content-type: text/plain;' http://127.0.0.1:58812/ ``` ``` $ veil-cli setminingalgo randomx { "success": true, "message": "Mining algorithm changed from sha256d to randomx" } veil-cli getmininginfo { [...] "algorithm": "randomx", "difficulty": 0.003707938785486674, "networkhashps": 22.73835278085342, [...] } ``` ``` $ veil-cli setminingalgo sha257d error code: -8 error message: sha257d is not a supported mining type $ veil-cli setminingalgo sha256d { "success": true, "message": "Mining algorithm changed from randomx to sha256d" } $ veil-cli getmininginfo { [...] "algorithm": "sha256d", "difficulty": 18.1774015474177, "networkhashps": 23.05669884097939, [...] } ``` ``` $ veil-cli generatecontinuous true 1 $ veil-cli setminingalgo progpow error code: -8 error message: mining must be stopped to change algorithm $ veil-cli generatecontinuous false $ veil-cli setminingalgo progpow { "success": true, "message": "Mining algorithm changed from sha256d to progpow" } $ veil-cli getmininginfo { [...] "algorithm": "progpow", "difficulty": 164.7481194885794, "networkhashps": 23.16038554216868, [...] } ``` Tree-SHA512: 89c8a5032856afcf48ba0ec6c0c9636d9f451e705efe1b9545c3b1719e7db7897d6721a5bf2663f4e3b0d05600c46acff5b6e9c4dd7d3ec3ab2fc47311a328d4
- Loading branch information
Showing
3 changed files
with
56 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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