Qt/Options: Configure walletrbf using rwconf

This commit is contained in:
Luke Dashjr 2017-02-07 22:41:52 +00:00
parent b2645bf424
commit 7a31573d08
4 changed files with 34 additions and 0 deletions

View File

@ -188,6 +188,14 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
ui->maxuploadtarget->setMaximum(std::numeric_limits<int>::max());
connect(ui->maxuploadtargetCheckbox, SIGNAL(toggled(bool)), ui->maxuploadtarget, SLOT(setEnabled(bool)));
prevwidget = ui->tabWidget;
walletrbf = new QCheckBox(ui->tabWallet);
walletrbf->setText(tr("Request Replace-By-Fee"));
walletrbf->setToolTip(tr("Indicates that the sender may wish to replace this transaction with a new one paying higher fees (prior to being confirmed). Can be overridden per send."));
ui->verticalLayout_Wallet->insertWidget(0, walletrbf);
FixTabOrder(walletrbf);
prevwidget = ui->peerbloomfilters;
/* Mempool tab */
@ -490,6 +498,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(ui->pruneSizeMiB, OptionsModel::PruneSizeMiB);
/* Wallet */
mapper->addMapping(walletrbf, OptionsModel::walletrbf);
mapper->addMapping(ui->addressType, OptionsModel::addresstype);
mapper->addMapping(ui->spendZeroConfChange, OptionsModel::SpendZeroConfChange);
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);

View File

@ -94,6 +94,8 @@ private:
void FixTabOrder(QWidget *);
void CreateOptionUI(QBoxLayout *, QWidget *, const QString& text);
QCheckBox *walletrbf;
QValueComboBox *mempoolreplacement;
QSpinBox *maxorphantx;
QSpinBox *maxmempool;

View File

@ -586,6 +586,10 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
return QVariant::fromValue(m_font_qrcodes);
case PeersTabAlternatingRowColors:
return m_peers_tab_alternating_row_colors;
#ifdef ENABLE_WALLET
case walletrbf:
return gArgs.GetBoolArg("-walletrbf", wallet::DEFAULT_WALLET_RBF);
#endif
case CoinControlFeatures:
return fCoinControlFeatures;
case EnablePSBTControls:
@ -860,6 +864,24 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
settings.setValue("PeersTabAlternatingRowColors", m_peers_tab_alternating_row_colors);
Q_EMIT peersTabAlternatingRowColorsChanged(m_peers_tab_alternating_row_colors);
break;
#ifdef ENABLE_WALLET
case walletrbf:
if (changed()) {
const bool fNewValue = value.toBool();
const std::string newvalue_str = strprintf("%d", fNewValue);
gArgs.ModifyRWConfigFile("walletrbf", newvalue_str);
gArgs.ForceSetArg("-walletrbf", newvalue_str);
for (auto& wallet_interface : m_node.walletLoader().getWallets()) {
wallet::CWallet *wallet;
if (wallet_interface && (wallet = wallet_interface->wallet())) {
wallet->m_signal_rbf = fNewValue;
} else {
setRestartRequired(true);
}
}
}
break;
#endif
case CoinControlFeatures:
fCoinControlFeatures = value.toBool();
settings.setValue("fCoinControlFeatures", fCoinControlFeatures);

View File

@ -64,6 +64,7 @@ public:
FontForMoney, // FontChoice
FontForQRCodes, // FontChoice
PeersTabAlternatingRowColors, // bool
walletrbf, // bool
CoinControlFeatures, // bool
SubFeeFromAmount, // bool
ThreadsScriptVerif, // int