From 5467a4509d8303226a816edd6ee32db69d37f923 Mon Sep 17 00:00:00 2001 From: fsb4000 Date: Mon, 24 Nov 2014 13:07:09 +0600 Subject: [PATCH] Wallet refuses to create mints with zero reward. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Запрещает кошельку создавать PoS блоки с отрицательной или нулевой наградой. Аналогично https://github.com/ppcoin/ppcoin/pull/66/ --- src/wallet.cpp | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) 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 +} -- 1.7.1