mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-12 19:20:42 +02:00
Qt/Options: Configure mempoolreplacement using rwconf
This commit is contained in:
parent
654ee797d9
commit
0892562e43
@ -196,7 +196,11 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
|
||||
QVBoxLayout * const verticalLayout_Mempool = new QVBoxLayout(tabMempool);
|
||||
ui->tabWidget->insertTab(ui->tabWidget->indexOf(ui->tabWindow), tabMempool, tr("Mem&pool"));
|
||||
|
||||
// TODO
|
||||
mempoolreplacement = new QValueComboBox(tabMempool);
|
||||
mempoolreplacement->addItem(QString("never"), QVariant("never"));
|
||||
mempoolreplacement->addItem(QString("with a higher mining fee, and opt-in"), QVariant("fee,optin"));
|
||||
mempoolreplacement->addItem(QString("with a higher mining fee (no opt-out)"), QVariant("fee,-optin"));
|
||||
CreateOptionUI(verticalLayout_Mempool, mempoolreplacement, tr("Transaction &replacement: %s"));
|
||||
|
||||
QGroupBox * const groupBox_Spamfiltering = new QGroupBox(tabMempool);
|
||||
groupBox_Spamfiltering->setTitle(tr("Spam filtering"));
|
||||
@ -440,6 +444,16 @@ void OptionsDialog::setMapper()
|
||||
ui->peerblockfilters->setToolTip(ui->peerblockfilters->toolTip() + " " + tr("(only available if enabled at least once before turning on pruning)"));
|
||||
}
|
||||
|
||||
/* Mempool tab */
|
||||
|
||||
QVariant current_mempoolreplacement = model->data(model->index(OptionsModel::mempoolreplacement, 0), Qt::EditRole);
|
||||
int current_mempoolreplacement_index = mempoolreplacement->findData(current_mempoolreplacement);
|
||||
if (current_mempoolreplacement_index == -1) {
|
||||
mempoolreplacement->addItem(current_mempoolreplacement.toString(), current_mempoolreplacement);
|
||||
current_mempoolreplacement_index = mempoolreplacement->count() - 1;
|
||||
}
|
||||
mempoolreplacement->setCurrentIndex(current_mempoolreplacement_index);
|
||||
|
||||
/* Window */
|
||||
#ifndef Q_OS_MACOS
|
||||
if (QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||
@ -556,6 +570,8 @@ void OptionsDialog::on_okButton_clicked()
|
||||
model->setData(model->index(OptionsModel::maxuploadtarget, 0), 0);
|
||||
}
|
||||
|
||||
model->setData(model->index(OptionsModel::mempoolreplacement, 0), mempoolreplacement->itemData(mempoolreplacement->currentIndex()));
|
||||
|
||||
mapper->submit();
|
||||
accept();
|
||||
updateDefaultProxyNets();
|
||||
|
@ -16,6 +16,7 @@ QT_BEGIN_NAMESPACE
|
||||
class QBoxLayout;
|
||||
class QDataWidgetMapper;
|
||||
class QString;
|
||||
class QValueComboBox;
|
||||
class QWidget;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@ -85,6 +86,8 @@ private:
|
||||
QWidget *prevwidget{nullptr};
|
||||
void FixTabOrder(QWidget *);
|
||||
void CreateOptionUI(QBoxLayout *, QWidget *, const QString& text);
|
||||
|
||||
QValueComboBox *mempoolreplacement;
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_OPTIONSDIALOG_H
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <node/chainstatemanager_args.h>
|
||||
#include <node/context.h>
|
||||
#include <outputtype.h>
|
||||
#include <policy/settings.h>
|
||||
#include <txdb.h> // for -dbcache defaults
|
||||
#include <util/string.h>
|
||||
#include <validation.h> // For DEFAULT_SCRIPTCHECK_THREADS
|
||||
@ -203,6 +204,16 @@ OptionsModel::FontChoice OptionsModel::FontChoiceFromString(const QString& s)
|
||||
}
|
||||
}
|
||||
|
||||
static QString CanonicalMempoolReplacement(const OptionsModel& model)
|
||||
{
|
||||
switch (model.node().mempool().m_opts.rbf_policy) {
|
||||
case RBFPolicy::Never: return "never";
|
||||
case RBFPolicy::OptIn: return "fee,optin";
|
||||
case RBFPolicy::Always: return "fee,-optin";
|
||||
}
|
||||
assert(0);
|
||||
}
|
||||
|
||||
OptionsModel::OptionsModel(interfaces::Node& node, QObject *parent) :
|
||||
QAbstractListModel(parent), m_node{node}
|
||||
{
|
||||
@ -622,6 +633,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
|
||||
return f_peerbloomfilters;
|
||||
case peerblockfilters:
|
||||
return gArgs.GetBoolArg("-peerblockfilters", DEFAULT_PEERBLOCKFILTERS);
|
||||
case mempoolreplacement:
|
||||
return CanonicalMempoolReplacement(*this);
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@ -925,6 +938,21 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
|
||||
}
|
||||
break;
|
||||
}
|
||||
case mempoolreplacement:
|
||||
{
|
||||
if (changed()) {
|
||||
QString nv = value.toString();
|
||||
if (nv == "never") {
|
||||
node().mempool().m_opts.rbf_policy = RBFPolicy::Never;
|
||||
} else if (nv == "fee,optin") {
|
||||
node().mempool().m_opts.rbf_policy = RBFPolicy::OptIn;
|
||||
} else { // "fee,-optin"
|
||||
node().mempool().m_opts.rbf_policy = RBFPolicy::Always;
|
||||
}
|
||||
gArgs.ModifyRWConfigFile("mempoolreplacement", nv.toStdString());
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ public:
|
||||
maxuploadtarget,
|
||||
peerbloomfilters, // bool
|
||||
peerblockfilters, // bool
|
||||
mempoolreplacement,
|
||||
OptionIDRowCount,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user