X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fwallet.cpp;h=a60cfcacc6628e65a76727392f4eab89277cbe3c;hp=8acc82526a748529a5cb3783bbd8a49da0c3980c;hb=6a467ea5724ee2bd7a6f53af3abcc5a57effafbb;hpb=a9b672e77d90ac92e47dd67bb81aa6368259f439 diff --git a/src/wallet.cpp b/src/wallet.cpp index 8acc825..a60cfca 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1207,12 +1207,15 @@ bool CWallet::CreateCoinStake(unsigned int nBits, CTransaction& txNew) txNew.vout.push_back(CTxOut(0, scriptEmpty)); // Choose coins to use int64 nBalance = GetBalance(); - if (nBalance <= nBalanceReserve) + int64 nReserveBalance = 0; + if (mapArgs.count("-reservebalance") && !ParseMoney(mapArgs["-reservebalance"], nReserveBalance)) + return error("CreateCoinStake : invalid reserve balance amount"); + if (nBalance <= nReserveBalance) return false; set > setCoins; vector vwtxPrev; int64 nValueIn = 0; - if (!SelectCoins(nBalance - nBalanceReserve, txNew.nTime, setCoins, nValueIn)) + if (!SelectCoins(nBalance - nReserveBalance, txNew.nTime, setCoins, nValueIn)) return false; if (setCoins.empty()) return false; @@ -1246,13 +1249,13 @@ bool CWallet::CreateCoinStake(unsigned int nBits, CTransaction& txNew) break; } } - if (nCredit == 0 || nCredit > nBalance - nBalanceReserve) + if (nCredit == 0 || nCredit > nBalance - nReserveBalance) return false; BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins) { if (pcoin.first->vout[pcoin.second].scriptPubKey == txNew.vout[1].scriptPubKey && pcoin.first->GetHash() != txNew.vin[0].prevout.hash) { - if (nCredit + pcoin.first->vout[pcoin.second].nValue > nBalance - nBalanceReserve) + if (nCredit + pcoin.first->vout[pcoin.second].nValue > nBalance - nReserveBalance) break; txNew.vin.push_back(CTxIn(pcoin.first->GetHash(), pcoin.second)); nCredit += pcoin.first->vout[pcoin.second].nValue;