From 6b7c937114258acef77b2f2541edc9eb73a9fff9 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 11 Feb 2014 12:49:33 +0100 Subject: [PATCH] Add option to avoid spending unconfirmed change Conflicts: src/init.cpp src/wallet.cpp src/wallet.h Rebased-from: 86d40cab2725e758f4ddaf1e1149f0ab897df110 0.8.x --- src/init.cpp | 2 ++ src/wallet.cpp | 4 +++- src/wallet.h | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index 1704bdad3..0a963b98b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -358,6 +358,7 @@ std::string HelpMessage() " -rpcthreads= " + _("Set the number of threads to service RPC calls (default: 4)") + "\n" + " -blocknotify= " + _("Execute command when the best block changes (%s in cmd is replaced by block hash)") + "\n" + " -walletnotify= " + _("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= " + _("Execute command when a relevant alert is received (%s in cmd is replaced by message)") + "\n" + " -upgradewallet " + _("Upgrade wallet to latest format") + "\n" + " -keypool= " + _("Set key pool size to (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")) { diff --git a/src/wallet.cpp b/src/wallet.cpp index cd5a3f9eb..da288bdf6 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -14,6 +14,8 @@ using namespace std; +bool bSpendZeroConfChange = true; + ////////////////////////////////////////////////////////////////////////////// // // mapWallet @@ -1170,7 +1172,7 @@ bool CWallet::SelectCoins(int64 nTargetValue, set