X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fwallet.cpp;h=96dbdeb7f4702fd08a88d19acb6f14c87ce9a93f;hp=a78a76b0c16aeea8bc670811c4a17ed8325bf2ff;hb=5467a4509d8303226a816edd6ee32db69d37f923;hpb=ea40b3fa855e043b7bf1a82301b462c3de1b071b diff --git a/src/wallet.cpp b/src/wallet.cpp index a78a76b..96dbdeb 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -2043,7 +2043,13 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int CTxDB txdb("r"); if (!txNew.GetCoinAge(txdb, nCoinAge)) return error("CreateCoinStake : failed to calculate coin age"); - nCredit += GetProofOfStakeReward(nCoinAge, nBits, txNew.nTime); + + int64 nReward = GetProofOfStakeReward(nCoinAge, nBits, txNew.nTime); + // Refuse to create mint that has zero or negative reward + if(nReward <= 0) + return false; + + nCredit += nReward; } int64 nMinFee = 0; @@ -2798,4 +2804,4 @@ void CWallet::ClearOrphans() for(list::const_iterator it = orphans.begin(); it != orphans.end(); ++it) EraseFromWallet(*it); -} \ No newline at end of file +}