|
9 | 9 | #include "appcache.h"
|
10 | 10 | #include "init.h" // for pwalletMain
|
11 | 11 | #include "block.h"
|
| 12 | +#include "neuralnet/tally.h" |
12 | 13 |
|
13 | 14 | double GetTotalBalance();
|
14 | 15 | std::string TimestampToHRDate(double dtm);
|
15 | 16 | double CoinToDouble(double surrogate);
|
16 | 17 | double DoubleFromAmount(int64_t amount);
|
17 | 18 | std::string PubKeyToAddress(const CScript& scriptPubKey);
|
18 | 19 | bool GetEarliestStakeTime(std::string grcaddress, std::string cpid);
|
19 |
| -CBlockIndex* GetHistoricalMagnitude(std::string cpid); |
| 20 | +const CBlockIndex* GetHistoricalMagnitude(const NN::MiningId mining_id); |
20 | 21 | bool WalletOutOfSync();
|
21 | 22 |
|
22 | 23 | namespace NN { std::string GetPrimaryCpid(); }
|
@@ -97,8 +98,7 @@ std::pair<std::string, std::string> CreateVoteContract(std::string sTitle, std::
|
97 | 98 | const std::string primary_cpid = NN::GetPrimaryCpid();
|
98 | 99 |
|
99 | 100 | std::string GRCAddress = DefaultWalletAddress();
|
100 |
| - StructCPID& structMag = GetInitializedStructCPID2(primary_cpid, mvMagnitudes); |
101 |
| - double dmag = structMag.Magnitude; |
| 101 | + double dmag = NN::Tally::MyMagnitude(); |
102 | 102 | double poll_duration = PollDuration(sTitle) * 86400;
|
103 | 103 |
|
104 | 104 | // Prevent Double Voting
|
@@ -293,8 +293,7 @@ std::string GetProvableVotingWeightXML()
|
293 | 293 | //Retrieve the historical magnitude
|
294 | 294 | if (IsResearcher(primary_cpid))
|
295 | 295 | {
|
296 |
| - GetLifetimeCPID(primary_cpid); // Rescan... |
297 |
| - CBlockIndex* pHistorical = GetHistoricalMagnitude(primary_cpid); |
| 296 | + const CBlockIndex* pHistorical = GetHistoricalMagnitude(NN::MiningId::Parse(primary_cpid)); |
298 | 297 | if (pHistorical->nHeight > 1 && pHistorical->nMagnitude > 0)
|
299 | 298 | {
|
300 | 299 | std::string sBlockhash = pHistorical->GetBlockHash().GetHex();
|
@@ -462,10 +461,9 @@ double ReturnVerifiedVotingMagnitude(std::string sXML, bool bCreatedAfterSecurit
|
462 | 461 |
|
463 | 462 | double GetMoneySupplyFactor()
|
464 | 463 | {
|
465 |
| - StructCPID structcpid = mvNetwork["NETWORK"]; |
466 |
| - double TotalCPIDS = mvMagnitudes.size(); |
467 |
| - double AvgMagnitude = structcpid.NetworkAvgMagnitude; |
468 |
| - double TotalNetworkMagnitude = TotalCPIDS*AvgMagnitude; |
| 464 | + const NN::NetworkStats stats = NN::Tally::GetNetworkStats(); |
| 465 | + |
| 466 | + double TotalNetworkMagnitude = stats.m_total_cpids * stats.m_average_magnitude; |
469 | 467 | if (TotalNetworkMagnitude < 100) TotalNetworkMagnitude=100;
|
470 | 468 | double MoneySupply = DoubleFromAmount(pindexBest->nMoneySupply);
|
471 | 469 | double Factor = (MoneySupply/TotalNetworkMagnitude+.01);
|
|
0 commit comments