Browse Source

Better estimated luck with less numerical error

pull/112/head
Duke 1 year ago
parent
commit
5f28567cc9
  1. 8
      src/rpc.cpp

8
src/rpc.cpp

@ -928,12 +928,14 @@ void RPC::getInfoThenRefresh(bool force) {
luck->display( QString("-") );
} else {
// luck = current estimate of time to find a block given current localhash and nethash
double percentOfNetHash = localhashps.toDouble() / networkhashps.toInt();
//TODO: maybe use this as a tooltip
double percentOfNetHash = localhashps.toDouble() / networkhashps.toDouble();
DEBUG( "% of nethash=" << percentOfNetHash );
if (percentOfNetHash > 0) {
if (localhashps.toDouble() > 0) {
//TODO: this is only for DRAGONX
int blocktime = 36;
double luckInSeconds = (1/percentOfNetHash)*blocktime;
double luckInSeconds = (networkhashps.toDouble()/localhashps.toDouble())*blocktime;
double luckInHours = luckInSeconds / (60*60);
luck->display( QString::number( luckInHours , 'f', 2 ) );
}

Loading…
Cancel
Save