Browse Source

Change default fee estimation mode.

Fee estimates will default to be non-conservative if the transaction in question is opt-in-RBF.
0.15
Alex Morcos 8 years ago
parent
commit
f0bf33da83
  1. 2
      src/qt/coincontroldialog.cpp
  2. 5
      src/qt/sendcoinsdialog.cpp
  3. 2
      src/wallet/feebumper.cpp
  4. 5
      src/wallet/wallet.cpp
  5. 2
      src/wallet/wallet.h

2
src/qt/coincontroldialog.cpp

@ -490,7 +490,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
else nBytesInputs += 148; else nBytesInputs += 148;
} }
bool conservative_estimate = CalculateEstimateType(FeeEstimateMode::UNSET); bool conservative_estimate = CalculateEstimateType(FeeEstimateMode::UNSET, coinControl->signalRbf);
// calculation // calculation
if (nQuantity > 0) if (nQuantity > 0)

5
src/qt/sendcoinsdialog.cpp

@ -166,6 +166,8 @@ void SendCoinsDialog::setModel(WalletModel *_model)
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(updateFeeSectionControls())); connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(updateFeeSectionControls()));
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(updateGlobalFeeVariables())); connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(updateGlobalFeeVariables()));
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels()));
connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(updateSmartFeeLabel()));
connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels()));
ui->customFee->setSingleStep(CWallet::GetRequiredFee(1000)); ui->customFee->setSingleStep(CWallet::GetRequiredFee(1000));
updateFeeSectionControls(); updateFeeSectionControls();
updateMinFeeLabel(); updateMinFeeLabel();
@ -652,7 +654,7 @@ void SendCoinsDialog::updateSmartFeeLabel()
int nBlocksToConfirm = ui->sliderSmartFee->maximum() - ui->sliderSmartFee->value() + 2; int nBlocksToConfirm = ui->sliderSmartFee->maximum() - ui->sliderSmartFee->value() + 2;
FeeCalculation feeCalc; FeeCalculation feeCalc;
bool conservative_estimate = CalculateEstimateType(FeeEstimateMode::UNSET); bool conservative_estimate = CalculateEstimateType(FeeEstimateMode::UNSET, ui->optInRBF->isChecked());
CFeeRate feeRate = ::feeEstimator.estimateSmartFee(nBlocksToConfirm, &feeCalc, ::mempool, conservative_estimate); CFeeRate feeRate = ::feeEstimator.estimateSmartFee(nBlocksToConfirm, &feeCalc, ::mempool, conservative_estimate);
if (feeRate <= CFeeRate(0)) // not enough data => minfee if (feeRate <= CFeeRate(0)) // not enough data => minfee
{ {
@ -828,6 +830,7 @@ void SendCoinsDialog::coinControlUpdateLabels()
} else { } else {
CoinControlDialog::coinControl->nConfirmTarget = model->getDefaultConfirmTarget(); CoinControlDialog::coinControl->nConfirmTarget = model->getDefaultConfirmTarget();
} }
CoinControlDialog::coinControl->signalRbf = ui->optInRBF->isChecked();
for(int i = 0; i < ui->entries->count(); ++i) for(int i = 0; i < ui->entries->count(); ++i)
{ {

2
src/wallet/feebumper.cpp

@ -165,7 +165,7 @@ CFeeBumper::CFeeBumper(const CWallet *pWallet, const uint256 txidIn, int newConf
nNewFee = totalFee; nNewFee = totalFee;
nNewFeeRate = CFeeRate(totalFee, maxNewTxSize); nNewFeeRate = CFeeRate(totalFee, maxNewTxSize);
} else { } 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); nNewFee = CWallet::GetMinimumFee(maxNewTxSize, newConfirmTarget, mempool, ::feeEstimator, nullptr /* FeeCalculation */, ignoreGlobalPayTxFee, conservative_estimate);
nNewFeeRate = CFeeRate(nNewFee, maxNewTxSize); nNewFeeRate = CFeeRate(nNewFee, maxNewTxSize);

5
src/wallet/wallet.cpp

@ -2725,7 +2725,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
currentConfirmationTarget = coinControl->nConfirmTarget; currentConfirmationTarget = coinControl->nConfirmTarget;
// Allow to override the default fee estimate mode over the CoinControl instance // 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); CAmount nFeeNeeded = GetMinimumFee(nBytes, currentConfirmationTarget, ::mempool, ::feeEstimator, &feeCalc, false /* ignoreGlobalPayTxFee */, conservative_estimate);
if (coinControl && coinControl->fOverrideFeeRate) 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); return ::AcceptToMemoryPool(mempool, state, tx, true, NULL, NULL, false, nAbsurdFee);
} }
bool CalculateEstimateType(FeeEstimateMode mode) { bool CalculateEstimateType(FeeEstimateMode mode, bool opt_in_rbf) {
switch (mode) { switch (mode) {
case FeeEstimateMode::UNSET: case FeeEstimateMode::UNSET:
return !opt_in_rbf; // Allow for lower fees if RBF is an option
case FeeEstimateMode::CONSERVATIVE: case FeeEstimateMode::CONSERVATIVE:
return true; return true;
case FeeEstimateMode::ECONOMICAL: case FeeEstimateMode::ECONOMICAL:

2
src/wallet/wallet.h

@ -1213,6 +1213,6 @@ bool CWallet::DummySignTx(CMutableTransaction &txNew, const ContainerType &coins
return true; return true;
} }
bool CalculateEstimateType(FeeEstimateMode mode); bool CalculateEstimateType(FeeEstimateMode mode, bool opt_in_rbf);
#endif // BITCOIN_WALLET_WALLET_H #endif // BITCOIN_WALLET_WALLET_H

Loading…
Cancel
Save