Skip to content

Commit

Permalink
Fix split-on-stake logic. Currently it's deciding whether to split ba…
Browse files Browse the repository at this point in the history
…sed on age, but then actually splitting based on size if -splitsize is set.
  • Loading branch information
dooglus committed Feb 23, 2015
1 parent e23670c commit 3f15194
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2112,7 +2112,10 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
vwtxPrev.push_back(pcoin.first);
txNew.vout.push_back(CTxOut(0, scriptPubKeyOut));

if (GetWeight(block.GetBlockTime(), (int64_t)txNew.nTime) < GetStakeSplitAge())
// if we're splitting on size, only split if adding 1 to the current size will make it double the split size
// and if we're not, split on age
if (( nSplitSize && nCredit >= nSplitSize * 2 - 1) ||
(!nSplitSize && GetWeight(block.GetBlockTime(), (int64_t)txNew.nTime) < GetStakeSplitAge()))
txNew.vout.push_back(CTxOut(0, scriptPubKeyOut)); //split stake
LogPrint("coinstake", "CreateCoinStake : added kernel type=%d\n", whichType);
fKernelFound = true;
Expand Down

0 comments on commit 3f15194

Please sign in to comment.