-
Notifications
You must be signed in to change notification settings - Fork 181
Add stake splitting and side staking info to getmininginfo #1424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add stake splitting and side staking info to getmininginfo #1424
Conversation
Addresses #1391. |
int64_t nMinStakeSplitValue = 0; | ||
double dEfficiency = 0; | ||
SideStakeAlloc vSideStakeAlloc = {}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Speculation on my part: instead of calling the parsing function here, read the global variables from miner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not global. I purposely did not make them global. I would rather not create more globals for this unless we really need to. More globals = more locks and more headaches. The overhead of the called functions is low anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I thought the values were stored in globals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But now we would have rpc that just returns info from config file. This is quite unusual, because RPCs usually return some runtime or chain data, not stuff that could be read from config. Aha I see that the values are altered on load, so having the output in rpc to see what is actually going on is useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because there are clamps, etc... We may have to go to globals when we implement the UI table to allow changing on the fly... but that is a larger discussion that belongs in the new UI work I think...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, something easy to add to the rpc would be the UTXO size calculated for the current specified efficiency and diff average. Basically line 830 and 831 of miner.cpp...
nDesiredStakeOutputValue = G * GetAverageDifficulty(160) * (3.0 / 2.0) * (1 / dEfficiency - 1) * COIN;
nDesiredStakeOutputValue = max(nMinStakeSplitValue, nDesiredStakeOutputValue);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could just add that in to GetStakeSplitStatusAndParams and put nDesiredStakeOutputValue as an out parameter. The biggest overhead is the diff calculation over 160 blocks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did it. Let me know if you have any suggestion on what I did. I think it is ok... and didn't have to take any additional locks for GetDifficulty call, since cs_main was already taken at the beginning of the rpc call.
Ok @tomasbrod. That should do it. |
I refactored the parameter parsing in miner.cpp into separate callable functions that can be used safely from both the miner and rpc calls. getmininginfo has been changed to include information on the status and parameters of stake splitting and side staking. It also includes the UTXO size needed to stake at the supplied efficiency in the config file.
9558cc7
to
119a3fb
Compare
I redid as one commit. Also, I found a code block that I failed to remove from StakeMiner() when I refactored it. Can't believe I didn't catch that. (The code was the clamp around efficiency... so it was idempotent the second time around.) |
Any more comments on this folks? |
Added: - Replace NeuralNetwork with portable C++ scraper #1387 (@jamescowens, @tomasbrod, @Cycy, @TheCharlatan, @denravonska). - Allow compile flags to be used for depends #1423 (@G-UK). - Add stake splitting and side staking info to getmininginfo #1424 (@jamescowens). - Add freedesktop.org desktop file and icon set #1438 (@a123b). Changed: - Disable Qt for windows Travis builds #1276 (@TheCharlatan). - Replace use of AppCache PROJECT section with strongly-typed structures #1415 (@cyrossignol). - Change dumpwallet to use appropriate data directory #1416 (@jamescowens). - Optimize ExtractXML() calls by avoiding unnecessary string copies #1419 (@cyrossignol). - Change signature of IsLockTimeWithinMinutes #1422 (@jamescowens). - Restore old poll output for getmininginfo RPC #1437 (@a123b). - Prevent segfault when using rpc savescraperfilemanifest #1439 (@jamescowens). - Improve miner status messages for ineligible staking balances #1447 (@cyrossignol). - Enhance scraper log archiving #1449 (@jamescowens). Fixed: - Re-enable full GUI 32-bit Windows builds - part of #1387 (@jamescowens). - Re-activate Windows Installer #1409 (@TheCharlatan). - Fix Depends and Travis build issues for ARM #1417 (@jamescowens). - Fix syncupdate icons #1421 (@jamescowens). - Fix potential BOINC crash when reading projects #1426 (@cyrossignol). - Fix freeze when unlocking wallet #1428 (@denravonska). - Fix RPC after high priority alert #1432 (@denravonska). - Fix missing poll in GUI when most recent poll expired #1455 (@cyrossignol). Removed: - Remove old, rudimentary side staking implementation #1381 (@denravonska). - Remove auto unlock #1402 (@denravonska). - Remove superblock forwarding #1430 (@denravonska).
I refactored the parameter parsing in miner.cpp into separate
callable functions that can be used safely from both the miner and
rpc calls.
getmininginfo has been changed to include information on the status
and parameters of stake splitting and side staking.