diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-02-11 22:14:04 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-02-11 22:14:13 +0100 |
commit | 19e5b9d2dfcac4efadba636745485d9660fb1abe (patch) | |
tree | 9389a122047da512c3545337bd278c06f72b0c3c | |
parent | 2bc52f1c4a7d66661ed26e100a914e68df6d2bcc (diff) | |
parent | 1bbca249b202c4802cc2c4d4de4a26e6392b4d92 (diff) |
Merge pull request #3651
1bbca24 Add option to avoid spending unconfirmed change (Wladimir J. van der Laan)
-rw-r--r-- | src/init.cpp | 2 | ||||
-rw-r--r-- | src/wallet.cpp | 3 | ||||
-rw-r--r-- | src/wallet.h | 1 |
3 files changed, 5 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp index 4d16f46968..12fb129073 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -274,6 +274,7 @@ std::string HelpMessage(HelpMessageMode hmm) strUsage += " -upgradewallet " + _("Upgrade wallet to latest format") + "\n"; strUsage += " -wallet=<file> " + _("Specify wallet file (within data directory)") + "\n"; strUsage += " -walletnotify=<cmd> " + _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)") + "\n"; + strUsage += " -spendzeroconfchange " + _("Spend unconfirmed change when sending transactions (default: 1)") + "\n"; #endif strUsage += "\n" + _("Block creation options:") + "\n"; strUsage += " -blockminsize=<n> " + _("Set minimum block size in bytes (default: 0)") + "\n"; @@ -539,6 +540,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); strWalletFile = GetArg("-wallet", "wallet.dat"); #endif diff --git a/src/wallet.cpp b/src/wallet.cpp index 979560651c..0e51ebb448 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -18,6 +18,7 @@ using namespace std; // Settings int64_t nTransactionFee = 0; +bool bSpendZeroConfChange = true; ////////////////////////////////////////////////////////////////////////////// // @@ -1192,7 +1193,7 @@ bool CWallet::SelectCoins(int64_t nTargetValue, set<pair<const CWalletTx*,unsign 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))); } diff --git a/src/wallet.h b/src/wallet.h index dc8c007ac8..1bf9bb185c 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -25,6 +25,7 @@ // Settings extern int64_t nTransactionFee; +extern bool bSpendZeroConfChange; class CAccountingEntry; class CCoinControl; |