aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorAlex Morcos <morcos@chaincode.com>2017-06-13 14:02:55 -0400
committerAlex Morcos <morcos@chaincode.com>2017-07-06 22:20:23 -0400
commitf0bf33da8357bd6aff100bbe5b84a7f01937e379 (patch)
tree7fe52cd82773d8bd31f35fc74489d1527784c53b /src/wallet
parente0738e3d319ab50466bf76c95841bb7275ad4d22 (diff)
downloadbitcoin-f0bf33da8357bd6aff100bbe5b84a7f01937e379.tar.xz
Change default fee estimation mode.
Fee estimates will default to be non-conservative if the transaction in question is opt-in-RBF.
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/feebumper.cpp2
-rw-r--r--src/wallet/wallet.cpp5
-rw-r--r--src/wallet/wallet.h2
3 files changed, 5 insertions, 4 deletions
diff --git a/src/wallet/feebumper.cpp b/src/wallet/feebumper.cpp
index a36f6798f0..a25530d8bd 100644
--- a/src/wallet/feebumper.cpp
+++ b/src/wallet/feebumper.cpp
@@ -165,7 +165,7 @@ CFeeBumper::CFeeBumper(const CWallet *pWallet, const uint256 txidIn, int newConf
nNewFee = totalFee;
nNewFeeRate = CFeeRate(totalFee, maxNewTxSize);
} else {
- bool conservative_estimate = CalculateEstimateType(FeeEstimateMode::UNSET);
+ bool conservative_estimate = CalculateEstimateType(FeeEstimateMode::UNSET, newTxReplaceable);
nNewFee = CWallet::GetMinimumFee(maxNewTxSize, newConfirmTarget, mempool, ::feeEstimator, nullptr /* FeeCalculation */, ignoreGlobalPayTxFee, conservative_estimate);
nNewFeeRate = CFeeRate(nNewFee, maxNewTxSize);
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index a43b5398e0..9a5f6b2791 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -2725,7 +2725,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
currentConfirmationTarget = coinControl->nConfirmTarget;
// Allow to override the default fee estimate mode over the CoinControl instance
- bool conservative_estimate = CalculateEstimateType(coinControl ? coinControl->m_fee_mode : FeeEstimateMode::UNSET);
+ bool conservative_estimate = CalculateEstimateType(coinControl ? coinControl->m_fee_mode : FeeEstimateMode::UNSET, rbf);
CAmount nFeeNeeded = GetMinimumFee(nBytes, currentConfirmationTarget, ::mempool, ::feeEstimator, &feeCalc, false /* ignoreGlobalPayTxFee */, conservative_estimate);
if (coinControl && coinControl->fOverrideFeeRate)
@@ -4158,9 +4158,10 @@ bool CMerkleTx::AcceptToMemoryPool(const CAmount& nAbsurdFee, CValidationState&
return ::AcceptToMemoryPool(mempool, state, tx, true, NULL, NULL, false, nAbsurdFee);
}
-bool CalculateEstimateType(FeeEstimateMode mode) {
+bool CalculateEstimateType(FeeEstimateMode mode, bool opt_in_rbf) {
switch (mode) {
case FeeEstimateMode::UNSET:
+ return !opt_in_rbf; // Allow for lower fees if RBF is an option
case FeeEstimateMode::CONSERVATIVE:
return true;
case FeeEstimateMode::ECONOMICAL:
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 813bf530ac..e3715cdf37 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -1213,6 +1213,6 @@ bool CWallet::DummySignTx(CMutableTransaction &txNew, const ContainerType &coins
return true;
}
-bool CalculateEstimateType(FeeEstimateMode mode);
+bool CalculateEstimateType(FeeEstimateMode mode, bool opt_in_rbf);
#endif // BITCOIN_WALLET_WALLET_H