mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-28 04:52:36 +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);
|
QVBoxLayout * const verticalLayout_Mempool = new QVBoxLayout(tabMempool);
|
||||||
ui->tabWidget->insertTab(ui->tabWidget->indexOf(ui->tabWindow), tabMempool, tr("Mem&pool"));
|
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);
|
QGroupBox * const groupBox_Spamfiltering = new QGroupBox(tabMempool);
|
||||||
groupBox_Spamfiltering->setTitle(tr("Spam filtering"));
|
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)"));
|
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 */
|
/* Window */
|
||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
if (QSystemTrayIcon::isSystemTrayAvailable()) {
|
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::maxuploadtarget, 0), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model->setData(model->index(OptionsModel::mempoolreplacement, 0), mempoolreplacement->itemData(mempoolreplacement->currentIndex()));
|
||||||
|
|
||||||
mapper->submit();
|
mapper->submit();
|
||||||
accept();
|
accept();
|
||||||
updateDefaultProxyNets();
|
updateDefaultProxyNets();
|
||||||
|
@ -16,6 +16,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
class QBoxLayout;
|
class QBoxLayout;
|
||||||
class QDataWidgetMapper;
|
class QDataWidgetMapper;
|
||||||
class QString;
|
class QString;
|
||||||
|
class QValueComboBox;
|
||||||
class QWidget;
|
class QWidget;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
@ -85,6 +86,8 @@ private:
|
|||||||
QWidget *prevwidget{nullptr};
|
QWidget *prevwidget{nullptr};
|
||||||
void FixTabOrder(QWidget *);
|
void FixTabOrder(QWidget *);
|
||||||
void CreateOptionUI(QBoxLayout *, QWidget *, const QString& text);
|
void CreateOptionUI(QBoxLayout *, QWidget *, const QString& text);
|
||||||
|
|
||||||
|
QValueComboBox *mempoolreplacement;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BITCOIN_QT_OPTIONSDIALOG_H
|
#endif // BITCOIN_QT_OPTIONSDIALOG_H
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <node/chainstatemanager_args.h>
|
#include <node/chainstatemanager_args.h>
|
||||||
#include <node/context.h>
|
#include <node/context.h>
|
||||||
#include <outputtype.h>
|
#include <outputtype.h>
|
||||||
|
#include <policy/settings.h>
|
||||||
#include <txdb.h> // for -dbcache defaults
|
#include <txdb.h> // for -dbcache defaults
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
#include <validation.h> // For DEFAULT_SCRIPTCHECK_THREADS
|
#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) :
|
OptionsModel::OptionsModel(interfaces::Node& node, QObject *parent) :
|
||||||
QAbstractListModel(parent), m_node{node}
|
QAbstractListModel(parent), m_node{node}
|
||||||
{
|
{
|
||||||
@ -622,6 +633,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
|
|||||||
return f_peerbloomfilters;
|
return f_peerbloomfilters;
|
||||||
case peerblockfilters:
|
case peerblockfilters:
|
||||||
return gArgs.GetBoolArg("-peerblockfilters", DEFAULT_PEERBLOCKFILTERS);
|
return gArgs.GetBoolArg("-peerblockfilters", DEFAULT_PEERBLOCKFILTERS);
|
||||||
|
case mempoolreplacement:
|
||||||
|
return CanonicalMempoolReplacement(*this);
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -925,6 +938,21 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
|
|||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,7 @@ public:
|
|||||||
maxuploadtarget,
|
maxuploadtarget,
|
||||||
peerbloomfilters, // bool
|
peerbloomfilters, // bool
|
||||||
peerblockfilters, // bool
|
peerblockfilters, // bool
|
||||||
|
mempoolreplacement,
|
||||||
OptionIDRowCount,
|
OptionIDRowCount,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user