Skip to content

Commit 2ed03d4

Browse files
committed
Refactor to remove DoubleFromAmount() function
1 parent ae6f3d7 commit 2ed03d4

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

src/contract/polls.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
double GetTotalBalance();
1616
std::string TimestampToHRDate(double dtm);
1717
double CoinToDouble(double surrogate);
18-
double DoubleFromAmount(int64_t amount);
1918
std::string PubKeyToAddress(const CScript& scriptPubKey);
2019
bool GetEarliestStakeTime(std::string grcaddress, std::string cpid);
2120
const CBlockIndex* GetHistoricalMagnitude(const NN::MiningId mining_id);
@@ -466,7 +465,7 @@ double GetMoneySupplyFactor()
466465

467466
double TotalNetworkMagnitude = superblock->m_cpids.TotalMagnitude();
468467
if (TotalNetworkMagnitude < 100) TotalNetworkMagnitude=100;
469-
double MoneySupply = DoubleFromAmount(pindexBest->nMoneySupply);
468+
double MoneySupply = (double)pindexBest->nMoneySupply / COIN;
470469
double Factor = (MoneySupply/TotalNetworkMagnitude+.01);
471470
return Factor;
472471
}

src/rpcblockchain.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ extern ConvergedScraperStats ConvergedScraperStatsCache;
2828
using namespace std;
2929

3030
extern std::string YesNo(bool bin);
31-
extern double DoubleFromAmount(int64_t amount);
3231
bool AskForOutstandingBlocks(uint256 hashStart);
3332
bool ForceReorganizeToHash(uint256 NewHash);
3433
extern UniValue MagnitudeReport(const NN::Cpid cpid);
@@ -1919,11 +1918,6 @@ UniValue MagnitudeReport(const NN::Cpid cpid)
19191918
return json;
19201919
}
19211920

1922-
double DoubleFromAmount(int64_t amount)
1923-
{
1924-
return (double)amount / (double)COIN;
1925-
}
1926-
19271921
UniValue GetJSONBeaconReport()
19281922
{
19291923
UniValue results(UniValue::VARR);

src/rpcrawtransaction.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ std::string TimestampToHRDate(double dtm);
2828
std::string GetPollXMLElementByPollTitle(std::string pollname, std::string XMLElement1, std::string XMLElement2);
2929
std::string GetShareType(double dShareType);
3030
bool PollCreatedAfterSecurityUpgrade(std::string pollname);
31-
double DoubleFromAmount(int64_t amount);
3231

3332
std::vector<std::pair<std::string, std::string>> GetTxStakeBoincHashInfo(const CMerkleTx& mtx)
3433
{
@@ -259,7 +258,7 @@ std::vector<std::pair<std::string, std::string>> GetTxNormalBoincHashInfo(const
259258

260259
double dOutAverage = superblock.m_cpids.AverageMagnitude();
261260
double dTotalNetworkMagnitude = (double)superblock.m_cpids.size() * dOutAverage;
262-
double dMoneySupply = DoubleFromAmount(pblockindex->nMoneySupply);
261+
double dMoneySupply = (double)pblockindex->nMoneySupply / COIN;
263262
double dMoneySupplyFactor = (dMoneySupply/dTotalNetworkMagnitude + .01);
264263

265264
dVoteMagnitude = RoundFromString(sVoteMagnitude,2);

0 commit comments

Comments
 (0)