PPCoin: When creating transaction any sub-cent change is added to fee
authorSunny King <sunnyking9999@gmail.com>
Mon, 6 Aug 2012 16:14:50 +0000 (17:14 +0100)
committerSunny King <sunnyking9999@gmail.com>
Mon, 6 Aug 2012 16:14:50 +0000 (17:14 +0100)
        as we can no longer make such a change output due to 8bb2917

src/wallet.cpp

index 144c4b3..bfc57b6 100644 (file)
@@ -1126,6 +1126,13 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64> >& vecSend, CW
                     nFeeRet += nMoveToFee;
                 }
 
+                // ppcoin: sub-cent change is moved to fee
+                if (nChange > 0 && nChange < MIN_TXOUT_AMOUNT)
+                {
+                    nFeeRet += nChange;
+                    nChange = 0;
+                }
+
                 if (nChange > 0)
                 {
                     // Note: We use a new key here to keep it from being obvious which side is the change.