Skip to content
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

Fix diagnostics, add ETTS test, fix tooltipcolor, add missing lock, and add email=investor check #1647

Merged
Merged
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ double GetAverageDifficulty(unsigned int nPoSInterval)
return result;
}

double GetEstimatedTimetoStake(double dDiff, double dConfidence)
double GetEstimatedTimetoStake(bool ignore_staking_status, double dDiff, double dConfidence)
{
/*
* The algorithm below is an attempt to come up with a more accurate way of estimating Time to Stake (ETTS) based on
Expand Down Expand Up @@ -378,8 +378,8 @@ double GetEstimatedTimetoStake(double dDiff, double dConfidence)
}

bool staking = MinerStatus.nLastCoinStakeSearchInterval && MinerStatus.WeightSum;
// Get out early if not staking and set return value of 0.
if (!staking)
// Get out early if not staking and ignore_staking_status is false and set return value of 0.
if (!staking && !ignore_staking_status)
{
if (fDebug10) LogPrintf("GetEstimatedTimetoStake debug: Not staking: ETTS = %f", result);
return result;
Expand Down
8 changes: 4 additions & 4 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,12 @@ double GetEstimatedNetworkWeight(unsigned int nPoSInterval = 40);
double GetDifficulty(const CBlockIndex* blockindex = NULL);
double GetBlockDifficulty(unsigned int nBits);
double GetAverageDifficulty(unsigned int nPoSInterval = 40);

// Note that dDiff cannot be = 0 normally. This is set as default because you can't specify the output of
// GetAverageDifficulty(nPosInterval) = to dDiff here.
// The defeult confidence is 1-1/e which is the mean for the geometric distribution.

const double DEFAULT_ETTS_CONFIDENCE = 0.632120558829;
double GetEstimatedTimetoStake(double dDiff = 0.0, double dConfidence = DEFAULT_ETTS_CONFIDENCE);
// The defeult confidence is 1-1/e which is the mean for the geometric distribution for small probabilities.
const double DEFAULT_ETTS_CONFIDENCE = 1.0 - 1.0 / exp(1.0);
double GetEstimatedTimetoStake(bool ignore_staking_status = false, double dDiff = 0.0, double dConfidence = DEFAULT_ETTS_CONFIDENCE);

NN::ClaimOption GetClaimByIndex(const CBlockIndex* const pblockindex);

Expand Down
2 changes: 1 addition & 1 deletion src/neuralnet/researcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ std::string Researcher::Email()

bool Researcher::ConfiguredForInvestorMode(bool log)
{
if (GetBoolArg("-investor", false)) {
if (GetBoolArg("-investor", false) || Researcher::Email() == "investor") {
if (log) LogPrintf("Investor mode configured. Skipping CPID import.");
return true;
}
Expand Down
20 changes: 15 additions & 5 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,12 +553,12 @@ void BitcoinGUI::createToolBars()
// Use a red color for the toolbars background if on testnet.
if (GetBoolArg("-testnet"))
{
toolbar2->setStyleSheet("background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 darkRed, stop: 1 darkRed)");
toolbar2->setStyleSheet("background-color:darkRed");
toolbar3->setStyleSheet("background-color:darkRed");
}
else
{
toolbar2->setStyleSheet("background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(65,0,127), stop: 1 rgb(65,0,127))");
toolbar2->setStyleSheet("background-color:rgb(65,0,127)");
toolbar3->setStyleSheet("background-color:rgb(65,0,127)");
}

Expand Down Expand Up @@ -722,10 +722,10 @@ void BitcoinGUI::aboutClicked()
dlg.exec();
}

void BitcoinGUI::setNumConnections(int count)
void BitcoinGUI::setNumConnections(int n)
{
QString icon;
switch(count)
switch (n)
{
case 0: icon = ":/icons/connect_0"; break;
case 1: case 2: case 3: icon = ":/icons/connect_1"; break;
Expand All @@ -734,7 +734,17 @@ void BitcoinGUI::setNumConnections(int count)
default: icon = ":/icons/connect_4"; break;
}
labelConnectionsIcon->setPixmap(QIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelConnectionsIcon->setToolTip(tr("%1 active connection(s) to Gridcoin network").arg(count));

if (n == 0)
{
labelConnectionsIcon->setToolTip(tr("No active connections to the Gridcoin network. "
"If this persists more than a few minutes, please check your configuration "
"and your network connectivity."));
}
else
{
labelConnectionsIcon->setToolTip(tr("%n active connection(s) to the Gridcoin network", "", n));
}
}

void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
Expand Down
Loading