diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2015-11-25 13:04:52 +0100 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2015-11-30 14:09:04 +0100 |
commit | ecc7c82361d98268d86b399dac76ca6d99bde889 (patch) | |
tree | fdb697ed742d1d48301da334837fecdb736856a1 /src | |
parent | 96b802510da0750aabc4f3ba6750cb5ce76f2b8c (diff) |
Move fPayAtLeastCustomFee function to CC
Diffstat (limited to 'src')
-rw-r--r-- | src/coincontrol.h | 3 | ||||
-rw-r--r-- | src/wallet/wallet.cpp | 7 | ||||
-rw-r--r-- | src/wallet/wallet.h | 1 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/coincontrol.h b/src/coincontrol.h index bc965f9e19..3945644ce8 100644 --- a/src/coincontrol.h +++ b/src/coincontrol.h @@ -16,6 +16,8 @@ public: bool fAllowOtherInputs; //! Includes watch only addresses which match the ISMINE_WATCH_SOLVABLE criteria bool fAllowWatchOnly; + //! Minimum absolute fee (not per kilobyte) + CAmount nMinimumTotalFee; CCoinControl() { @@ -28,6 +30,7 @@ public: fAllowOtherInputs = false; fAllowWatchOnly = false; setSelected.clear(); + nMinimumTotalFee = 0; } bool HasSelected() const diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index b062226dd9..2412074be3 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -41,7 +41,6 @@ CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE; unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET; bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE; bool fSendFreeTransactions = DEFAULT_SEND_FREE_TRANSACTIONS; -bool fPayAtLeastCustomFee = false; /** * Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) @@ -2017,6 +2016,9 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt } CAmount nFeeNeeded = GetMinimumFee(nBytes, nTxConfirmTarget, mempool); + if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) { + nFeeNeeded = coinControl->nMinimumTotalFee; + } // If we made it here and we aren't even able to meet the relay fee on the next pass, give up // because we must be at the maximum allowed fee. @@ -2112,9 +2114,6 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge { // payTxFee is user-set "I want to pay this much" CAmount nFeeNeeded = payTxFee.GetFee(nTxBytes); - // user selected total at least (default=true) - if (fPayAtLeastCustomFee && nFeeNeeded > 0 && nFeeNeeded < payTxFee.GetFeePerK()) - nFeeNeeded = payTxFee.GetFeePerK(); // User didn't set: use -txconfirmtarget to estimate... if (nFeeNeeded == 0) { int estimateFoundTarget = nConfirmTarget; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index a4199488fc..88bf27498f 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -35,7 +35,6 @@ extern CAmount maxTxFee; extern unsigned int nTxConfirmTarget; extern bool bSpendZeroConfChange; extern bool fSendFreeTransactions; -extern bool fPayAtLeastCustomFee; static const unsigned int DEFAULT_KEYPOOL_SIZE = 100; //! -paytxfee default |