Skip to content

Commit ecc7c82

Browse files
sipajonasschnelli
authored andcommitted
Move fPayAtLeastCustomFee function to CC
1 parent 96b8025 commit ecc7c82

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/coincontrol.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class CCoinControl
1616
bool fAllowOtherInputs;
1717
//! Includes watch only addresses which match the ISMINE_WATCH_SOLVABLE criteria
1818
bool fAllowWatchOnly;
19+
//! Minimum absolute fee (not per kilobyte)
20+
CAmount nMinimumTotalFee;
1921

2022
CCoinControl()
2123
{
@@ -28,6 +30,7 @@ class CCoinControl
2830
fAllowOtherInputs = false;
2931
fAllowWatchOnly = false;
3032
setSelected.clear();
33+
nMinimumTotalFee = 0;
3134
}
3235

3336
bool HasSelected() const

src/wallet/wallet.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE;
4141
unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET;
4242
bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE;
4343
bool fSendFreeTransactions = DEFAULT_SEND_FREE_TRANSACTIONS;
44-
bool fPayAtLeastCustomFee = false;
4544

4645
/**
4746
* 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
20172016
}
20182017

20192018
CAmount nFeeNeeded = GetMinimumFee(nBytes, nTxConfirmTarget, mempool);
2019+
if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) {
2020+
nFeeNeeded = coinControl->nMinimumTotalFee;
2021+
}
20202022

20212023
// If we made it here and we aren't even able to meet the relay fee on the next pass, give up
20222024
// because we must be at the maximum allowed fee.
@@ -2112,9 +2114,6 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge
21122114
{
21132115
// payTxFee is user-set "I want to pay this much"
21142116
CAmount nFeeNeeded = payTxFee.GetFee(nTxBytes);
2115-
// user selected total at least (default=true)
2116-
if (fPayAtLeastCustomFee && nFeeNeeded > 0 && nFeeNeeded < payTxFee.GetFeePerK())
2117-
nFeeNeeded = payTxFee.GetFeePerK();
21182117
// User didn't set: use -txconfirmtarget to estimate...
21192118
if (nFeeNeeded == 0) {
21202119
int estimateFoundTarget = nConfirmTarget;

src/wallet/wallet.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ extern CAmount maxTxFee;
3535
extern unsigned int nTxConfirmTarget;
3636
extern bool bSpendZeroConfChange;
3737
extern bool fSendFreeTransactions;
38-
extern bool fPayAtLeastCustomFee;
3938

4039
static const unsigned int DEFAULT_KEYPOOL_SIZE = 100;
4140
//! -paytxfee default

0 commit comments

Comments
 (0)