mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-12 19:20:42 +02:00
GUI/Options: Configure mempooltruc using settings
This commit is contained in:
parent
fdfc57bd1a
commit
b399472de8
@ -237,6 +237,13 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
|
|||||||
mempoolreplacement->addItem(QString("with a higher mining fee (no opt-out)"), 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"));
|
CreateOptionUI(verticalLayout_Mempool, mempoolreplacement, tr("Transaction &replacement: %s"));
|
||||||
|
|
||||||
|
mempooltruc = new QValueComboBox(tabMempool);
|
||||||
|
mempooltruc->addItem(QString("do not relay or mine at all"), QVariant("reject"));
|
||||||
|
mempooltruc->addItem(QString("handle the same as other transactions"), QVariant("accept"));
|
||||||
|
mempooltruc->addItem(QString("impose stricter limits requested (DRAFT)"), QVariant("enforce"));
|
||||||
|
mempooltruc->setToolTip(tr("Some transactions signal a request to limit both themselves and other related transactions to more restrictive expectations. Specifically, this would disallow more than 1 unconfirmed predecessor or spending transaction, as well as smaller size limits (see BIP 431 for details), regardless of what policy you have configured."));
|
||||||
|
CreateOptionUI(verticalLayout_Mempool, mempooltruc, tr("Transactions requesting more restrictive policy limits (TRUC): %s"));
|
||||||
|
|
||||||
maxorphantx = new QSpinBox(tabMempool);
|
maxorphantx = new QSpinBox(tabMempool);
|
||||||
maxorphantx->setMinimum(0);
|
maxorphantx->setMinimum(0);
|
||||||
maxorphantx->setMaximum(std::numeric_limits<int>::max());
|
maxorphantx->setMaximum(std::numeric_limits<int>::max());
|
||||||
@ -707,6 +714,14 @@ void OptionsDialog::setMapper()
|
|||||||
}
|
}
|
||||||
mempoolreplacement->setCurrentIndex(current_mempoolreplacement_index);
|
mempoolreplacement->setCurrentIndex(current_mempoolreplacement_index);
|
||||||
|
|
||||||
|
QVariant current_mempooltruc = model->data(model->index(OptionsModel::mempooltruc, 0), Qt::EditRole);
|
||||||
|
int current_mempooltruc_index = mempooltruc->findData(current_mempooltruc);
|
||||||
|
if (current_mempooltruc_index == -1) {
|
||||||
|
mempooltruc->addItem(current_mempooltruc.toString(), current_mempooltruc);
|
||||||
|
current_mempooltruc_index = mempooltruc->count() - 1;
|
||||||
|
}
|
||||||
|
mempooltruc->setCurrentIndex(current_mempooltruc_index);
|
||||||
|
|
||||||
mapper->addMapping(maxorphantx, OptionsModel::maxorphantx);
|
mapper->addMapping(maxorphantx, OptionsModel::maxorphantx);
|
||||||
mapper->addMapping(maxmempool, OptionsModel::maxmempool);
|
mapper->addMapping(maxmempool, OptionsModel::maxmempool);
|
||||||
mapper->addMapping(incrementalrelayfee, OptionsModel::incrementalrelayfee);
|
mapper->addMapping(incrementalrelayfee, OptionsModel::incrementalrelayfee);
|
||||||
@ -920,6 +935,7 @@ void OptionsDialog::on_okButton_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
model->setData(model->index(OptionsModel::mempoolreplacement, 0), mempoolreplacement->itemData(mempoolreplacement->currentIndex()));
|
model->setData(model->index(OptionsModel::mempoolreplacement, 0), mempoolreplacement->itemData(mempoolreplacement->currentIndex()));
|
||||||
|
model->setData(model->index(OptionsModel::mempooltruc, 0), mempooltruc->itemData(mempooltruc->currentIndex()));
|
||||||
|
|
||||||
if (dustdynamic_enable->isChecked()) {
|
if (dustdynamic_enable->isChecked()) {
|
||||||
if (dustdynamic_target->isChecked()) {
|
if (dustdynamic_target->isChecked()) {
|
||||||
|
@ -103,6 +103,7 @@ private:
|
|||||||
QSpinBox *blockreconstructionextratxn;
|
QSpinBox *blockreconstructionextratxn;
|
||||||
|
|
||||||
QValueComboBox *mempoolreplacement;
|
QValueComboBox *mempoolreplacement;
|
||||||
|
QValueComboBox *mempooltruc;
|
||||||
QSpinBox *maxorphantx;
|
QSpinBox *maxorphantx;
|
||||||
BitcoinAmountField *incrementalrelayfee;
|
BitcoinAmountField *incrementalrelayfee;
|
||||||
QSpinBox *maxmempool;
|
QSpinBox *maxmempool;
|
||||||
|
@ -223,6 +223,16 @@ static QString CanonicalMempoolReplacement(const OptionsModel& model)
|
|||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString CanonicalMempoolTRUC(const OptionsModel& model)
|
||||||
|
{
|
||||||
|
switch (model.node().mempool().m_opts.truc_policy) {
|
||||||
|
case TRUCPolicy::Reject: return "reject";
|
||||||
|
case TRUCPolicy::Accept: return "accept";
|
||||||
|
case TRUCPolicy::Enforce: return "enforce";
|
||||||
|
}
|
||||||
|
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}
|
||||||
{
|
{
|
||||||
@ -650,6 +660,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
|
|||||||
return gArgs.GetBoolArg("-peerblockfilters", DEFAULT_PEERBLOCKFILTERS);
|
return gArgs.GetBoolArg("-peerblockfilters", DEFAULT_PEERBLOCKFILTERS);
|
||||||
case mempoolreplacement:
|
case mempoolreplacement:
|
||||||
return CanonicalMempoolReplacement(*this);
|
return CanonicalMempoolReplacement(*this);
|
||||||
|
case mempooltruc:
|
||||||
|
return CanonicalMempoolTRUC(*this);
|
||||||
case maxorphantx:
|
case maxorphantx:
|
||||||
return qlonglong(gArgs.GetIntArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS));
|
return qlonglong(gArgs.GetIntArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS));
|
||||||
case maxmempool:
|
case maxmempool:
|
||||||
@ -1049,6 +1061,21 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case mempooltruc:
|
||||||
|
{
|
||||||
|
if (changed()) {
|
||||||
|
QString nv = value.toString();
|
||||||
|
if (nv == "reject") {
|
||||||
|
node().mempool().m_opts.truc_policy = TRUCPolicy::Reject;
|
||||||
|
} else if (nv == "accept") {
|
||||||
|
node().mempool().m_opts.truc_policy = TRUCPolicy::Accept;
|
||||||
|
} else if (nv == "enforce") {
|
||||||
|
node().mempool().m_opts.truc_policy = TRUCPolicy::Enforce;
|
||||||
|
}
|
||||||
|
node().updateRwSetting("mempooltruc", nv.toStdString());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case maxorphantx:
|
case maxorphantx:
|
||||||
{
|
{
|
||||||
if (changed()) {
|
if (changed()) {
|
||||||
|
@ -82,6 +82,7 @@ public:
|
|||||||
peerbloomfilters, // bool
|
peerbloomfilters, // bool
|
||||||
peerblockfilters, // bool
|
peerblockfilters, // bool
|
||||||
mempoolreplacement,
|
mempoolreplacement,
|
||||||
|
mempooltruc,
|
||||||
maxorphantx,
|
maxorphantx,
|
||||||
maxmempool,
|
maxmempool,
|
||||||
incrementalrelayfee,
|
incrementalrelayfee,
|
||||||
|
Loading…
Reference in New Issue
Block a user