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

add tooltip to Est. TTS & Est. RR/day #1

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
324 changes: 303 additions & 21 deletions src/main.cpp

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ struct globalStatusType
std::string netWeight;
std::string coinWeight;
std::string magnitude;
std::string ETTS;
std::string ERRperday;
std::string project;
std::string cpid;
std::string status;
Expand Down Expand Up @@ -283,7 +285,9 @@ std::string UnpackBinarySuperblock(std::string sBlock);
bool IsSuperBlock(CBlockIndex* pIndex);
bool LoadSuperblock(std::string data, int64_t nTime, int height);

double GetPoSKernelPS();
double GetPoSKernelPS(int nPoSInterval = 40);
double GetAverageDifficulty(int nPoSInterval = 40);
double GetEstimatedTimetoStake(int nPoSInterval = 40, double dConfidence = 0.8);

unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime);
unsigned int ComputeMinStake(unsigned int nBase, int64_t nTime, unsigned int nBlockTime);
Expand Down
8 changes: 4 additions & 4 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1898,15 +1898,15 @@ void BitcoinGUI::updateStakingIcon()
uint64_t nWeight, nLastInterval;
std::string ReasonNotStaking;
{ LOCK(MinerStatus.lock);
// not using real weigh to not break calculation
nWeight = MinerStatus.ValueSum;
// not using real weight to not break calculation - fixed - but retaining GRC units for instead of internal weight units.
nWeight = MinerStatus.WeightSum / 80.0;
nLastInterval = MinerStatus.nLastCoinStakeSearchInterval;
ReasonNotStaking = MinerStatus.ReasonNotStaking;
}

uint64_t nNetworkWeight = GetPoSKernelPS();
uint64_t nNetworkWeight = GetPoSKernelPS() / 80.0;
bool staking = nLastInterval && nWeight;
uint64_t nEstimateTime = staking ? (GetTargetSpacing(nBestHeight) * nNetworkWeight / nWeight) : 0;
uint64_t nEstimateTime = GetEstimatedTimetoStake();

if (staking)
{
Expand Down
86 changes: 60 additions & 26 deletions src/qt/forms/overviewpage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -336,36 +336,59 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="labelCoinWeight">
<property name="text">
<string notr="true"/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Magnitude:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="labelMagnitude">
<property name="text">
<string notr="true"/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Project:</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_15">
<item row="5" column="1">
<widget class="QLabel" name="labelProject">
<property name="text">
<string>CPID:</string>
<string notr="true"/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_16">
<item row="6" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Status:</string>
<string>CPID:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="labelCoinWeight">
<item row="6" column="1">
<widget class="QLabel" name="labelCpid">
<property name="text">
<string notr="true"/>
</property>
Expand All @@ -374,18 +397,15 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="labelMagnitude">
<item row="7" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string notr="true"/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
<string>Status:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="labelProject">
<item row="7" column="1">
<widget class="QLabel" name="labelStatus">
<property name="text">
<string notr="true"/>
</property>
Expand All @@ -394,23 +414,37 @@
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="labelCpid">
<item row="8" column="0">
<widget class="QLabel" name="label">
<property name="toolTip">
<string>Estimated Time to Stake</string>
</property>
<property name="text">
<string notr="true"/>
<string>Est. TTS:</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="labelETTS">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="labelStatus">
<item row="9" column="0">
<widget class="QLabel" name="label_4">
<property name="toolTip">
<string>Estimated Research rewards per day</string>
</property>
<property name="text">
<string notr="true"/>
<string>Est. RR/day:</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="labelERRperday">
<property name="text">
<string/>
</property>
</widget>
</item>
Expand Down
2 changes: 2 additions & 0 deletions src/qt/overviewpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ void OverviewPage::UpdateBoincUtilization()
ui->labelStatus->setText(QString::fromUtf8(GlobalStatusStruct.status.c_str()));
ui->labelPoll->setText(QString::fromUtf8(GlobalStatusStruct.poll.c_str()).replace(QChar('_'),QChar(' '), Qt::CaseSensitive));
ui->labelErrors->setText(QString::fromUtf8(GlobalStatusStruct.errors.c_str()));
ui->labelETTS->setText(QString::fromUtf8(GlobalStatusStruct.ETTS.c_str()));
ui->labelERRperday->setText(QString::fromUtf8(GlobalStatusStruct.ERRperday.c_str()));
}

void OverviewPage::setModel(WalletModel *model)
Expand Down
4 changes: 3 additions & 1 deletion src/rpcmining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ Value getmininginfo(const Array& params, bool fHelp)
pwalletMain->GetStakeWeight(nWeight);
Object obj, diff, weight;
double nNetworkWeight = GetPoSKernelPS();
double nNetworkValue = nNetworkWeight / 80.0;
obj.push_back(Pair("blocks", nBestHeight));
diff.push_back(Pair("proof-of-stake", GetDifficulty(GetLastBlockIndex(pindexBest, true))));

{ LOCK(MinerStatus.lock);
// not using real weigh to not break calculation
bool staking = MinerStatus.nLastCoinStakeSearchInterval && MinerStatus.WeightSum;
uint64_t nExpectedTime = staking ? (GetTargetSpacing(nBestHeight) * nNetworkWeight / MinerStatus.ValueSum) : 0;
uint64_t nExpectedTime = GetEstimatedTimetoStake();
diff.push_back(Pair("last-search-interval", MinerStatus.nLastCoinStakeSearchInterval));
weight.push_back(Pair("minimum", MinerStatus.WeightMin));
weight.push_back(Pair("maximum", MinerStatus.WeightMax));
Expand All @@ -51,6 +52,7 @@ Value getmininginfo(const Array& params, bool fHelp)
weight.push_back(Pair("legacy", nWeight/(double)COIN));
obj.push_back(Pair("stakeweight", weight));
obj.push_back(Pair("netstakeweight", nNetworkWeight));
obj.push_back(Pair("netstakingGRCvalue", nNetworkValue));
obj.push_back(Pair("staking", staking));
obj.push_back(Pair("mining-error", MinerStatus.ReasonNotStaking));
obj.push_back(Pair("time-to-stake_days", nExpectedTime/86400.0));
Expand Down