|
|
@@ -1395,10 +1395,11 @@ bool CWallet::CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& w |
|
|
// ppcoin: create coin stake transaction
|
|
|
bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int64 nSearchInterval, CTransaction& txNew)
|
|
|
{
|
|
|
- // The following split & combine thresholds are important to security
|
|
|
- // Should not be adjusted if you don't understand the consequences
|
|
|
- static unsigned int nStakeSplitAge = (60 * 60 * 24 * 90);
|
|
|
- int64 nCombineThreshold = GetProofOfWorkReward(GetLastBlockIndex(pindexBest, false)->nBits) / 3;
|
|
|
+ // Keep combining coins until 10 times POW reward is reached.
|
|
|
+ int64 nCombineThreshold = GetProofOfWorkReward(GetLastBlockIndex(pindexBest, false)->nBits) * 10;
|
|
|
+ // Minimum age for coins that will be combined.
|
|
|
+ unsigned int nStakeCombineAge = 60 * 60 * 24 * 31;
|
|
|
+
|
|
|
// Keep a table of stuff to speed up POS mining
|
|
|
static map<uint256, PosMiningStuff *> mapMiningStuff;
|
|
|
|
|
|
@@ -1523,8 +1524,6 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int |
|
|
nCredit += pcoin.first->vout[pcoin.second].nValue;
|
|
|
vwtxPrev.push_back(pcoin.first);
|
|
|
txNew.vout.push_back(CTxOut(0, scriptPubKeyOut));
|
|
|
- if (block.GetBlockTime() + nStakeSplitAge > txNew.nTime)
|
|
|
- txNew.vout.push_back(CTxOut(0, scriptPubKeyOut)); //split stake
|
|
|
if (fDebug && GetBoolArg("-printcoinstake"))
|
|
|
printf("CreateCoinStake : added kernel type=%d\n", whichType);
|
|
|
fKernelFound = true;
|
|
|
@@ -1556,7 +1555,7 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int |
|
|
if (pcoin.first->vout[pcoin.second].nValue > nCombineThreshold)
|
|
|
continue;
|
|
|
// Do not add input that is still too young
|
|
|
- if (pcoin.first->nTime + nStakeMaxAge > txNew.nTime)
|
|
|
+ if (pcoin.first->nTime + nStakeCombineAge > txNew.nTime)
|
|
|
continue;
|
|
|
txNew.vin.push_back(CTxIn(pcoin.first->GetHash(), pcoin.second));
|
|
|
nCredit += pcoin.first->vout[pcoin.second].nValue;
|
|
|
|