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

Remove (lower) Mint Limiter #1212

Merged
merged 2 commits into from Jul 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion src/kernel.cpp
Expand Up @@ -13,7 +13,6 @@ using namespace std;
StructCPID GetStructCPID();
extern int64_t GetRSAWeightByCPID(std::string cpid);
extern int64_t GetRSAWeightByCPIDWithRA(std::string cpid);
double MintLimiter(double PORDiff,int64_t RSA_WEIGHT,std::string cpid,int64_t locktime);
extern double GetLastPaymentTimeByCPID(std::string cpid);
extern double GetUntrustedMagnitude(std::string cpid, double& out_owed);
bool LessVerbose(int iMax1000);
Expand Down
16 changes: 9 additions & 7 deletions src/main.cpp
Expand Up @@ -137,7 +137,6 @@ int64_t nLastCleaned = 0;

extern bool IsCPIDValidv3(std::string cpidv2, bool allow_investor);

double MintLimiter(double PORDiff,int64_t RSA_WEIGHT,std::string cpid,int64_t locktime);
double GetLastPaymentTimeByCPID(std::string cpid);
extern double CoinToDouble(double surrogate);
int64_t GetRSAWeightByCPID(std::string cpid);
Expand Down Expand Up @@ -3302,13 +3301,16 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex, bool fJustCheck, boo

if (pindex->nHeight > nGrandfather && !fReorganizing)
{
// Block Spamming
if (mint < MintLimiter(PORDiff,bb.RSAWeight,bb.cpid,GetBlockTime()))
if(nVersion < 10)
{
return error("CheckProofOfStake[] : Mint too Small, %f",(double)mint);
}
// Block Spamming
if (mint < MintLimiter(PORDiff,bb.RSAWeight,bb.cpid,GetBlockTime()))
{
return error("CheckProofOfStake[] : Mint too Small, %f",(double)mint);
}

if (mint == 0) return error("CheckProofOfStake[] : Mint is ZERO! %f",(double)mint);
if (mint == 0) return error("CheckProofOfStake[] : Mint is ZERO! %f",(double)mint);
}

double OUT_POR = 0;
double OUT_INTEREST = 0;
Expand Down Expand Up @@ -4270,7 +4272,7 @@ bool CBlock::CheckBlock(std::string sCaller, int height1, int64_t Mint, bool fCh
if (fDebug10) LogPrintf("CheckBlock[]: TotalSubsidy %f, Height %i, %s, %f, Res %f, Interest %f, hb: %s \n",
total_subsidy, height1, bb.cpid,
mint1,bb.ResearchSubsidy,bb.InterestSubsidy,vtx[0].hashBoinc);
if (total_subsidy < limiter)
if ((nVersion < 10) && (total_subsidy < limiter))
{
if (fDebug3) LogPrintf("****CheckBlock[]: Total Mint too Small %s, mint %f, Res %f, Interest %f, hash %s \n",bb.cpid,
mint1,bb.ResearchSubsidy,bb.InterestSubsidy,vtx[0].hashBoinc);
Expand Down
2 changes: 2 additions & 0 deletions src/main.h
Expand Up @@ -274,6 +274,8 @@ int64_t GetProofOfStakeReward(uint64_t nCoinAge, int64_t nFees, std::string cpid
bool VerifyingBlock, int VerificationPhase, int64_t nTime, CBlockIndex* pindexLast, std::string operation,
double& OUT_POR, double& OUT_INTEREST, double& dAccrualAge, double& dMagnitudeUnit, double& AvgMagnitude);

double MintLimiter(double PORDiff,int64_t RSA_WEIGHT,std::string cpid,int64_t locktime);

MiningCPID DeserializeBoincBlock(std::string block, int BlockVersion);
std::string SerializeBoincBlock(MiningCPID mcpid, int BlockVersion);
bool OutOfSyncByAge();
Expand Down
15 changes: 9 additions & 6 deletions src/miner.cpp
Expand Up @@ -26,7 +26,6 @@ using namespace std;
unsigned int nMinerSleep;
MiningCPID GetNextProject(bool bForce);
void ThreadCleanWalletPassphrase(void* parg);
double MintLimiter(double PORDiff,int64_t RSA_WEIGHT,std::string cpid,int64_t locktime);
double CoinToDouble(double surrogate);
StructCPID GetLifetimeCPID(const std::string& cpid, const std::string& sFrom);

Expand Down Expand Up @@ -793,16 +792,20 @@ bool CreateGridcoinReward(CBlock &blocknew, MiningCPID& miningcpid, uint64_t &nC

double mint = CoinToDouble(nReward);
double PORDiff = GetBlockDifficulty(blocknew.nBits);
double mintlimit = MintLimiter(PORDiff,RSA_WEIGHT,miningcpid.cpid,blocknew.nTime);

LogPrintf("CreateGridcoinReward: for %s mint %f {RSAWeight %f} Research %f, Interest %f \n",
miningcpid.cpid.c_str(), mint, (double)RSA_WEIGHT,miningcpid.ResearchSubsidy,miningcpid.InterestSubsidy);

//INVESTORS
if(blocknew.nVersion < 8) mintlimit = std::max(mintlimit, 0.0051);
if (nReward == 0 || mint < mintlimit)
// Mint Limiter
if(blocknew.nVersion < 10)
{
return error("CreateGridcoinReward: Mint %f of %f too small",(double)mint,(double)mintlimit);
double mintlimit = MintLimiter(PORDiff,RSA_WEIGHT,miningcpid.cpid,blocknew.nTime);
//INVESTORS
if(blocknew.nVersion < 8) mintlimit = std::max(mintlimit, 0.0051);
if (nReward == 0 || mint < mintlimit)
{
return error("CreateGridcoinReward: Mint %f of %f too small",(double)mint,(double)mintlimit);
}
}

//fill in reward and boinc
Expand Down
1 change: 0 additions & 1 deletion src/wallet.cpp
Expand Up @@ -27,7 +27,6 @@
using namespace std;

std::string SendReward(std::string sAddress, int64_t nAmount);
extern double MintLimiter(double PORDiff,int64_t RSA_WEIGHT,std::string cpid,int64_t locktime);
int64_t GetRSAWeightByCPID(std::string cpid);

MiningCPID DeserializeBoincBlock(std::string block);
Expand Down