Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/main.cpp b/src/main.cpp
- index f82e239..4642db9 100644
- --- a/src/main.cpp
- +++ b/src/main.cpp
- @@ -985,21 +985,20 @@ int64 GetProofOfWorkReward(unsigned int nBits)
- }
- // ppcoin: miner's coin stake is rewarded based on coin age spent (coin-days)
- -int64 GetProofOfStakeReward(int64 nCoinAge)
- +int64 GetProofOfStakeReward(int64 nCoinAge, unsigned int nTime)
- {
- static int64 nRewardCoinYear = 1; // creation amount per coin-year
- int64 nSubsidy = nCoinAge * 1 * nRewardCoinYear;
- // Reduce stake drastically 7 days after we stop accepting connections/blocks from
- // older clients. (8th January 2014 at 00:00:00 GMT)
- - int64 currentTimestamp = GetTime();
- - if(currentTimestamp >= 1389139200)
- + if (nTime >= STAKE_SWITCH_TIME)
- {
- nSubsidy = nCoinAge * 0.0001 * nRewardCoinYear;
- }
- if (fDebug && GetBoolArg("-printcreation"))
- {printf("GetProofOfStakeReward(): create=%s nCoinAge=%"PRI64d"\n", FormatMoney(nSubsidy).c_str(), nCoinAge);}
- -
- +
- return nSubsidy;
- }
- @@ -1392,7 +1391,7 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, MapPrevTx inputs,
- if (!GetCoinAge(txdb, nCoinAge))
- return error("ConnectInputs() : %s unable to get coin age for coinstake", GetHash().ToString().substr(0,10).c_str());
- int64 nStakeReward = GetValueOut() - nValueIn;
- - if (nStakeReward > GetProofOfStakeReward(nCoinAge) - GetMinFee() + MIN_TX_FEE)
- + if (nStakeReward > GetProofOfStakeReward(nCoinAge, nTime) - GetMinFee() + MIN_TX_FEE)
- return DoS(100, error("ConnectInputs() : %s stake reward exceeded", GetHash().ToString().substr(0,10).c_str()));
- }
- else
- diff --git a/src/main.h b/src/main.h
- index 8147a12..e811268 100644
- --- a/src/main.h
- +++ b/src/main.h
- @@ -35,6 +35,9 @@ static const int64 MIN_RELAY_TX_FEE = 0;
- static const int64 MAX_MONEY = 1000000000 * CENT;
- static const int64 MAX_MINT_PROOF_OF_WORK = 1 * CENT;
- static const int64 MIN_TXOUT_AMOUNT = MIN_TX_FEE;
- +
- +static const unsigned int STAKE_SWITCH_TIME = 1389139200; // Wed, 08 Jan 2014 00:00:00 GMT
- +
- inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
- // Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp.
- static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
- @@ -115,7 +118,7 @@ void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash
- bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey);
- bool CheckProofOfWork(uint256 hash, unsigned int nBits);
- int64 GetProofOfWorkReward(unsigned int nBits);
- -int64 GetProofOfStakeReward(int64 nCoinAge);
- +int64 GetProofOfStakeReward(int64 nCoinAge, unsigned int nTime);
- unsigned int ComputeMinWork(unsigned int nBase, int64 nTime);
- int GetNumBlocksOfPeers();
- bool IsInitialBlockDownload();
- diff --git a/src/wallet.cpp b/src/wallet.cpp
- index 92c17d5..bdf7293 100644
- --- a/src/wallet.cpp
- +++ b/src/wallet.cpp
- @@ -1503,7 +1503,7 @@ 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);
- + nCredit += GetProofOfStakeReward(nCoinAge, txNew.nTime);
- }
- int64 nMinFee = 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement