Add average hash rate to metrics
This commit is contained in:
parent
db853f8a46
commit
e7d59bbc12
|
@ -16,6 +16,7 @@
|
|||
|
||||
AtomicCounter transactionsValidated;
|
||||
AtomicCounter ehSolverRuns;
|
||||
AtomicCounter solutionTargetChecks;
|
||||
AtomicCounter minedBlocks;
|
||||
|
||||
boost::synchronized_value<std::list<std::string>> messageBox;
|
||||
|
@ -111,8 +112,11 @@ int printMetrics(size_t cols, int64_t nStart, bool mining)
|
|||
std::cout << "- " << strprintf(_("You have validated %d transactions."), transactionsValidated.get()) << std::endl;
|
||||
|
||||
if (mining) {
|
||||
double hps = uptime > 0 ? (double)solutionTargetChecks.get() / uptime : 0;
|
||||
std::string strHps = strprintf("%.4f H/s", hps);
|
||||
std::cout << "- " << strprintf(_("You have contributed %s on average to the network hash rate."), strHps) << std::endl;
|
||||
std::cout << "- " << strprintf(_("You have completed %d Equihash solver runs."), ehSolverRuns.get()) << std::endl;
|
||||
lines++;
|
||||
lines += 2;
|
||||
|
||||
int mined = minedBlocks.get();
|
||||
if (mined > 0) {
|
||||
|
|
|
@ -25,6 +25,7 @@ struct AtomicCounter {
|
|||
|
||||
extern AtomicCounter transactionsValidated;
|
||||
extern AtomicCounter ehSolverRuns;
|
||||
extern AtomicCounter solutionTargetChecks;
|
||||
extern AtomicCounter minedBlocks;
|
||||
|
||||
void ConnectMetricsScreen();
|
||||
|
|
|
@ -541,6 +541,7 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||
// Write the solution to the hash and compute the result.
|
||||
LogPrint("pow", "- Checking solution against target\n");
|
||||
pblock->nSolution = soln;
|
||||
solutionTargetChecks.increment();
|
||||
|
||||
if (UintToArith256(pblock->GetHash()) > hashTarget) {
|
||||
return false;
|
||||
|
|
|
@ -192,6 +192,7 @@ Value generate(const Array& params, bool fHelp)
|
|||
std::function<bool(std::vector<unsigned char>)> validBlock =
|
||||
[&pblock](std::vector<unsigned char> soln) {
|
||||
pblock->nSolution = soln;
|
||||
solutionTargetChecks.increment();
|
||||
return CheckProofOfWork(pblock->GetHash(), pblock->nBits, Params().GetConsensus());
|
||||
};
|
||||
bool found = EhBasicSolveUncancellable(n, k, curr_state, validBlock);
|
||||
|
|
Loading…
Reference in New Issue