mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 08:17:59 +00:00
Mining: Indicate probability of finding a block in one day
This commit is contained in:
parent
596b71b293
commit
50c22ca300
1 changed files with 13 additions and 1 deletions
|
@ -251,7 +251,19 @@ Rectangle {
|
||||||
|
|
||||||
function updateStatusText() {
|
function updateStatusText() {
|
||||||
if (appWindow.isMining) {
|
if (appWindow.isMining) {
|
||||||
statusText.text = qsTr("Mining at %1 H/s").arg(walletManager.miningHashRate()) + translationManager.emptyString;
|
var userHashRate = walletManager.miningHashRate();
|
||||||
|
if (userHashRate === 0) {
|
||||||
|
statusText.text = qsTr("Mining temporarily suspended.") + translationManager.emptyString;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var blockTime = 120;
|
||||||
|
var blocksPerDay = 86400 / blockTime;
|
||||||
|
var globalHashRate = walletManager.networkDifficulty() / blockTime;
|
||||||
|
var probabilityFindNextBlock = userHashRate / globalHashRate;
|
||||||
|
var probabilityFindBlockDay = 1 - Math.pow(1 - probabilityFindNextBlock, blocksPerDay);
|
||||||
|
var chanceFindBlockDay = Math.round(1 / probabilityFindBlockDay);
|
||||||
|
statusText.text = qsTr("Mining at %1 H/s. It gives you a 1 in %2 daily chance of finding a block.").arg(userHashRate).arg(chanceFindBlockDay) + translationManager.emptyString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
statusText.text = qsTr("Not mining") + translationManager.emptyString;
|
statusText.text = qsTr("Not mining") + translationManager.emptyString;
|
||||||
|
|
Loading…
Reference in a new issue