1414#include < boost/algorithm/string/replace.hpp>
1515
1616using namespace std ;
17- extern int nStakeMaxAge;
17+ extern unsigned int nStakeMaxAge;
1818
1919unsigned int nStakeSplitAge = 1 * 24 * 60 * 60 ;
2020int64 nStakeCombineThreshold = COIN ;
@@ -1497,7 +1497,7 @@ bool CWallet::GetStakeWeight(const CKeyStore& keystore, uint64& nMinWeight, uint
14971497 // Cache outputs unless best block changed
14981498 if (hashPrevBlock != pindexBest->GetBlockHash())
14991499 {
1500- if (!SelectCoinsSimple(nBalance - nReserveBalance, GetAdjustedTime(), nCoinbaseMaturity * 10, setCoins, nValueIn))
1500+ if (!SelectCoinsSimple(nBalance - nReserveBalance, GetAdjustedTime(), nCoinbaseMaturity + 10, setCoins, nValueIn))
15011501 return false;
15021502
15031503 if (setCoins.empty())
@@ -1510,7 +1510,7 @@ bool CWallet::GetStakeWeight(const CKeyStore& keystore, uint64& nMinWeight, uint
15101510 set<pair<const CWalletTx*,unsigned int > > setCoins;
15111511 int64 nValueIn = 0 ;
15121512
1513- if (!SelectCoinsSimple (nBalance - nReserveBalance, GetTime (), nCoinbaseMaturity * 10 , setCoins, nValueIn))
1513+ if (!SelectCoinsSimple (nBalance - nReserveBalance, GetTime (), nCoinbaseMaturity + 10 , setCoins, nValueIn))
15141514 return false ;
15151515
15161516 if (setCoins.empty ())
@@ -1586,7 +1586,7 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
15861586 // Cache outputs unless best block changed
15871587 if (hashPrevBlock != pindexBest->GetBlockHash())
15881588 {
1589- if (!SelectCoinsSimple(nBalance - nReserveBalance, txNew.nTime, nCoinbaseMaturity * 10, setCoins, nValueIn))
1589+ if (!SelectCoinsSimple(nBalance - nReserveBalance, txNew.nTime, nCoinbaseMaturity + 10, setCoins, nValueIn))
15901590 return false;
15911591
15921592 if (setCoins.empty())
@@ -1600,7 +1600,7 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
16001600 int64 nValueIn = 0 ;
16011601
16021602 // Select coins with suitable depth
1603- if (!SelectCoinsSimple (nBalance - nReserveBalance, txNew.nTime , nCoinbaseMaturity * 10 , setCoins, nValueIn))
1603+ if (!SelectCoinsSimple (nBalance - nReserveBalance, txNew.nTime , nCoinbaseMaturity + 10 , setCoins, nValueIn))
16041604 return false ;
16051605
16061606 if (setCoins.empty ())
@@ -1735,7 +1735,7 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
17351735 if (pcoin.first ->vout [pcoin.second ].nValue >= nStakeCombineThreshold)
17361736 continue ;
17371737 // Do not add input that is still too young
1738- if (nTimeWeight < nStakeMaxAge )
1738+ if (nTimeWeight < nStakeMinAge )
17391739 continue ;
17401740
17411741 txNew.vin .push_back (CTxIn (pcoin.first ->GetHash (), pcoin.second ));
0 commit comments