Add option to avoid spending unconfirmed change

Conflicts:
	src/init.cpp
	src/wallet.cpp
	src/wallet.h

Rebased-from: 86d40cab2725e758f4ddaf1e1149f0ab897df110 0.8.x
This commit is contained in:
Wladimir J. van der Laan 2014-02-11 12:49:33 +01:00 committed by Warren Togami
parent c1c35358fb
commit 6b7c937114
3 changed files with 7 additions and 1 deletions

View File

@ -358,6 +358,7 @@ std::string HelpMessage()
" -rpcthreads=<n> " + _("Set the number of threads to service RPC calls (default: 4)") + "\n" +
" -blocknotify=<cmd> " + _("Execute command when the best block changes (%s in cmd is replaced by block hash)") + "\n" +
" -walletnotify=<cmd> " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n" +
" -spendzeroconfchange " + _("Spend unconfirmed change when sending transactions (default: 1)") + "\n" +
" -alertnotify=<cmd> " + _("Execute command when a relevant alert is received (%s in cmd is replaced by message)") + "\n" +
" -upgradewallet " + _("Upgrade wallet to latest format") + "\n" +
" -keypool=<n> " + _("Set key pool size to <n> (default: 100)") + "\n" +
@ -627,6 +628,7 @@ bool AppInit2(boost::thread_group& threadGroup)
if (nTransactionFee > 0.25 * COIN)
InitWarning(_("Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction."));
}
bSpendZeroConfChange = GetArg("-spendzeroconfchange", true);
if (mapArgs.count("-mininput"))
{

View File

@ -14,6 +14,8 @@
using namespace std;
bool bSpendZeroConfChange = true;
//////////////////////////////////////////////////////////////////////////////
//
// mapWallet
@ -1170,7 +1172,7 @@ bool CWallet::SelectCoins(int64 nTargetValue, set<pair<const CWalletTx*,unsigned
return (SelectCoinsMinConf(nTargetValue, 1, 6, vCoins, setCoinsRet, nValueRet) ||
SelectCoinsMinConf(nTargetValue, 1, 1, vCoins, setCoinsRet, nValueRet) ||
SelectCoinsMinConf(nTargetValue, 0, 1, vCoins, setCoinsRet, nValueRet));
(bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue, 0, 1, vCoins, setCoinsRet, nValueRet)));
}

View File

@ -18,6 +18,8 @@
#include "util.h"
#include "walletdb.h"
extern bool bSpendZeroConfChange;
class CAccountingEntry;
class CWalletTx;
class CReserveKey;