Skip to content

Commit

Permalink
Merge pull request #1212 from tomasbrod/bv10-mint
Browse files Browse the repository at this point in the history
Remove (lower) Mint Limiter
  • Loading branch information
denravonska committed Jul 26, 2018
2 parents 2de7f3b + 5529759 commit be72d21
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
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 @@ -136,7 +136,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 @@ -3300,13 +3299,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 @@ -4268,7 +4270,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 ",
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 ",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 @@ -791,16 +790,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 ",
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 @@ -26,7 +26,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

0 comments on commit be72d21

Please sign in to comment.