Skip to content

Commit db6a5ab

Browse files
authored
Merge pull request #1647 from jamescowens/fixtooltipcolor
Fix diagnostics, add ETTS test, fix tooltipcolor, add missing lock, and add email=investor check
2 parents e932ee7 + b05ca69 commit db6a5ab

14 files changed

+744
-279
lines changed

src/main.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ double GetAverageDifficulty(unsigned int nPoSInterval)
341341
return result;
342342
}
343343

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

380380
bool staking = MinerStatus.nLastCoinStakeSearchInterval && MinerStatus.WeightSum;
381-
// Get out early if not staking and set return value of 0.
382-
if (!staking)
381+
// Get out early if not staking and ignore_staking_status is false and set return value of 0.
382+
if (!staking && !ignore_staking_status)
383383
{
384384
if (fDebug10) LogPrintf("GetEstimatedTimetoStake debug: Not staking: ETTS = %f", result);
385385
return result;

src/main.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,12 @@ double GetEstimatedNetworkWeight(unsigned int nPoSInterval = 40);
256256
double GetDifficulty(const CBlockIndex* blockindex = NULL);
257257
double GetBlockDifficulty(unsigned int nBits);
258258
double GetAverageDifficulty(unsigned int nPoSInterval = 40);
259+
259260
// Note that dDiff cannot be = 0 normally. This is set as default because you can't specify the output of
260261
// GetAverageDifficulty(nPosInterval) = to dDiff here.
261-
// The defeult confidence is 1-1/e which is the mean for the geometric distribution.
262-
263-
const double DEFAULT_ETTS_CONFIDENCE = 0.632120558829;
264-
double GetEstimatedTimetoStake(double dDiff = 0.0, double dConfidence = DEFAULT_ETTS_CONFIDENCE);
262+
// The defeult confidence is 1-1/e which is the mean for the geometric distribution for small probabilities.
263+
const double DEFAULT_ETTS_CONFIDENCE = 1.0 - 1.0 / exp(1.0);
264+
double GetEstimatedTimetoStake(bool ignore_staking_status = false, double dDiff = 0.0, double dConfidence = DEFAULT_ETTS_CONFIDENCE);
265265

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

src/neuralnet/researcher.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ std::string Researcher::Email()
484484

485485
bool Researcher::ConfiguredForInvestorMode(bool log)
486486
{
487-
if (GetBoolArg("-investor", false)) {
487+
if (GetBoolArg("-investor", false) || Researcher::Email() == "investor") {
488488
if (log) LogPrintf("Investor mode configured. Skipping CPID import.");
489489
return true;
490490
}

src/qt/bitcoingui.cpp

+15-5
Original file line numberDiff line numberDiff line change
@@ -553,12 +553,12 @@ void BitcoinGUI::createToolBars()
553553
// Use a red color for the toolbars background if on testnet.
554554
if (GetBoolArg("-testnet"))
555555
{
556-
toolbar2->setStyleSheet("background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 darkRed, stop: 1 darkRed)");
556+
toolbar2->setStyleSheet("background-color:darkRed");
557557
toolbar3->setStyleSheet("background-color:darkRed");
558558
}
559559
else
560560
{
561-
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))");
561+
toolbar2->setStyleSheet("background-color:rgb(65,0,127)");
562562
toolbar3->setStyleSheet("background-color:rgb(65,0,127)");
563563
}
564564

@@ -722,10 +722,10 @@ void BitcoinGUI::aboutClicked()
722722
dlg.exec();
723723
}
724724

725-
void BitcoinGUI::setNumConnections(int count)
725+
void BitcoinGUI::setNumConnections(int n)
726726
{
727727
QString icon;
728-
switch(count)
728+
switch (n)
729729
{
730730
case 0: icon = ":/icons/connect_0"; break;
731731
case 1: case 2: case 3: icon = ":/icons/connect_1"; break;
@@ -734,7 +734,17 @@ void BitcoinGUI::setNumConnections(int count)
734734
default: icon = ":/icons/connect_4"; break;
735735
}
736736
labelConnectionsIcon->setPixmap(QIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
737-
labelConnectionsIcon->setToolTip(tr("%1 active connection(s) to Gridcoin network").arg(count));
737+
738+
if (n == 0)
739+
{
740+
labelConnectionsIcon->setToolTip(tr("No active connections to the Gridcoin network. "
741+
"If this persists more than a few minutes, please check your configuration "
742+
"and your network connectivity."));
743+
}
744+
else
745+
{
746+
labelConnectionsIcon->setToolTip(tr("%n active connection(s) to the Gridcoin network", "", n));
747+
}
738748
}
739749

740750
void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)

0 commit comments

Comments
 (0)