Skip to content

Commit

Permalink
Fix sync issue
Browse files Browse the repository at this point in the history
  • Loading branch information
joelao95 committed Sep 11, 2017
1 parent b59a552 commit 78b8560
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ int64 GetProofOfWorkReward_OPM(const CBlockIndex* pindex0)
if (rDiff > rDiffcu && rSubsidy < 3.) {
rSubsidy = 6. * exp_n2( pow( abs( rDiff - (18.02428*exp_n(-M7Mv2_move/0.17628) + 6.58466*exp_n(-M7Mv2_move/0.71943) + 0.93489) )/(1./M7Mv2_move), 0.5 ), 0.);
}
if (IsMaintainence) rSubsidy *= 0.3;
if (IsMaintainence(pindex0)) rSubsidy *= 0.3;
rSubsidy *= double(COIN);
if (rSubsidy > 50*COIN) { rSubsidy = 50*COIN; }
else if (rSubsidy < MIN_TX_FEE) { rSubsidy = MIN_TX_FEE; }
Expand Down Expand Up @@ -1239,13 +1239,13 @@ double GetAnnualInterest(int64 nNetWorkWeit, double rMaxAPR)
return rAPR;
}

double GetAnnualInterestV2(int64 nNetWorkWeit, double rMaxAPR)
double GetAnnualInterestV2(int64 nNetWorkWeit, double rMaxAPR, CBlockIndex* pindex0)
{
double rAPR, rWeit=500000.;
// if (fTestNet) return GetAnnualInterest_TestNet(nNetWorkWeit, rMaxAPR);
rAPR = ( ( 2./( 1.+exp_n(1./(nNetWorkWeit/rWeit+1.)) ) - 0.53788 ) * rMaxAPR
/ ( 2./( 1.+exp_n(1./(rWeit+1.)) ) - 0.53788 ) );
if (IsMaintainence) rAPR *= 1.2;
if (pindex0 && IsMaintainence(pindex0)) rAPR *= 1.2;
if (fDebugMagiPoS) printf("@PoS-APRV2 rAPR = %f\n", rAPR);
return rAPR;
}
Expand All @@ -1255,7 +1255,7 @@ int64 GetProofOfStakeReward(int64 nCoinAge, int64 nFees, CBlockIndex* pindex)
{
int64 nNetWorkWeit = GetPoSKernelPS(pindex);
double rAPR = (IsPoSIIProtocolV2(pindex->nHeight+1)) ?
GetAnnualInterestV2(nNetWorkWeit, MAX_MAGI_PROOF_OF_STAKE) :
GetAnnualInterestV2(nNetWorkWeit, MAX_MAGI_PROOF_OF_STAKE, pindex) :
GetAnnualInterest(nNetWorkWeit, MAX_MAGI_PROOF_OF_STAKE);

int64 nSubsidy = nCoinAge * rAPR * COIN * 33 / (365 * 33 + 8);
Expand Down
1 change: 1 addition & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ double GetDifficultyFromBitsV2(const CBlockIndex* pindex0, bool fPrintInfo=false
double GetDifficultyFromBits(unsigned int nBits);
double GetAnnualInterest_TestNet(int64 nNetWorkWeit, double rMaxAPR);
double GetAnnualInterest(int64 nNetWorkWeit, double rMaxAPR);
double GetAnnualInterestV2(int64 nNetWorkWeit, double rMaxAPR, CBlockIndex* pindex0 = NULL);
bool IsChainInSwitch(const CBlockIndex* pindex_);
int GetCoinbaseMaturity(int nHeight);
//bool CheckMoneySupply(CBlockIndex* pindexPrev);
Expand Down
6 changes: 1 addition & 5 deletions src/rpcmining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ Value gethashespersec(const Array& params, bool fHelp)
return (boost::int64_t)dHashesPerSec;
}

int64 GetProofOfWorkRewardV2(const CBlockIndex* pindexPrev, int64 nFees, bool fLastBlock);
//double GetDifficultyFromBitsV2(const CBlockIndex* pindex0);
double GetAnnualInterest(int64 nNetWorkWeit, double rMaxAPR);
double GetAnnualInterestV2(int64 nNetWorkWeit, double rMaxAPR);
Value getmininginfo(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 0)
Expand All @@ -80,7 +76,7 @@ Value getmininginfo(const Array& params, bool fHelp)
((double)GetProofOfWorkRewardV2(pindexBest, 0, true))/((double)COIN) :
(double)((uint64_t)(GetProofOfWorkReward(pindexBest->nBits, pindexBest->nHeight, 0)/COIN));
double rAPR = (IsPoSIIProtocolV2(pindexBest->nHeight+1)) ?
GetAnnualInterestV2(nNetWorkWeit, MAX_MAGI_PROOF_OF_STAKE) :
GetAnnualInterestV2(nNetWorkWeit, MAX_MAGI_PROOF_OF_STAKE, pindexBest) :
GetAnnualInterest(nNetWorkWeit, MAX_MAGI_PROOF_OF_STAKE);

Object obj, diff, blockvalue, weight;
Expand Down

0 comments on commit 78b8560

Please sign in to comment.