GUI/Options: Configure acceptnonstddatacarrier using settings

This commit is contained in:
Luke Dashjr 2025-02-04 03:09:47 +00:00
parent 46897eda0e
commit f19978f20d
4 changed files with 19 additions and 0 deletions

View File

@ -344,6 +344,12 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
if (w != wf) datacarriercost->setValue(wf / 4); if (w != wf) datacarriercost->setValue(wf / 4);
}); });
rejectnonstddatacarrier = new QCheckBox(groupBox_Spamfiltering);
rejectnonstddatacarrier->setText(tr("Ignore data embedded with non-standard formats"));
rejectnonstddatacarrier->setToolTip(tr("Some attempts to spam Bitcoin intentionally use non-standard formats in an attempt to bypass the datacarrier limits. Without this option, %1 will attempt to detect these and enforce the intended limits. By enabling this option, your node will ignore these transactions entirely (when detected) even if they fall within the configured limits otherwise."));
verticalLayout_Spamfiltering->addWidget(rejectnonstddatacarrier);
FixTabOrder(rejectnonstddatacarrier);
dustrelayfee = new BitcoinAmountField(groupBox_Spamfiltering); dustrelayfee = new BitcoinAmountField(groupBox_Spamfiltering);
CreateOptionUI(verticalLayout_Spamfiltering, dustrelayfee, tr("Ignore transactions with values that would cost more to spend at a fee rate of %s per kvB (\"dust\").")); CreateOptionUI(verticalLayout_Spamfiltering, dustrelayfee, tr("Ignore transactions with values that would cost more to spend at a fee rate of %s per kvB (\"dust\")."));
@ -708,6 +714,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(maxscriptsize, OptionsModel::maxscriptsize); mapper->addMapping(maxscriptsize, OptionsModel::maxscriptsize);
mapper->addMapping(datacarriercost, OptionsModel::datacarriercost); mapper->addMapping(datacarriercost, OptionsModel::datacarriercost);
mapper->addMapping(datacarriersize, OptionsModel::datacarriersize); mapper->addMapping(datacarriersize, OptionsModel::datacarriersize);
mapper->addMapping(rejectnonstddatacarrier, OptionsModel::rejectnonstddatacarrier);
mapper->addMapping(dustrelayfee, OptionsModel::dustrelayfee); mapper->addMapping(dustrelayfee, OptionsModel::dustrelayfee);
QVariant current_dustdynamic = model->data(model->index(OptionsModel::dustdynamic, 0), Qt::EditRole); QVariant current_dustdynamic = model->data(model->index(OptionsModel::dustdynamic, 0), Qt::EditRole);

View File

@ -121,6 +121,7 @@ private:
QSpinBox *maxscriptsize; QSpinBox *maxscriptsize;
QSpinBox *datacarriersize; QSpinBox *datacarriersize;
QDoubleSpinBox *datacarriercost; QDoubleSpinBox *datacarriercost;
QCheckBox *rejectnonstddatacarrier;
BitcoinAmountField *dustrelayfee; BitcoinAmountField *dustrelayfee;
QCheckBox *dustdynamic_enable; QCheckBox *dustdynamic_enable;
QDoubleSpinBox *dustdynamic_multiplier; QDoubleSpinBox *dustdynamic_multiplier;

View File

@ -686,6 +686,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
return double(::g_weight_per_data_byte) / WITNESS_SCALE_FACTOR; return double(::g_weight_per_data_byte) / WITNESS_SCALE_FACTOR;
case datacarriersize: case datacarriersize:
return qlonglong(node().mempool().m_opts.max_datacarrier_bytes.value_or(0)); return qlonglong(node().mempool().m_opts.max_datacarrier_bytes.value_or(0));
case rejectnonstddatacarrier:
return !node().mempool().m_opts.accept_non_std_datacarrier;
case dustrelayfee: case dustrelayfee:
return qlonglong(node().mempool().m_opts.dust_relay_feerate_floor.GetFeePerK()); return qlonglong(node().mempool().m_opts.dust_relay_feerate_floor.GetFeePerK());
case dustdynamic: case dustdynamic:
@ -1222,6 +1224,14 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
} }
} }
break; break;
case rejectnonstddatacarrier:
if (changed()) {
// This option is inverted
const bool new_value = ! value.toBool();
node().updateRwSetting("acceptnonstddatacarrier" + suffix, new_value);
node().mempool().m_opts.accept_non_std_datacarrier = new_value;
}
break;
case dustrelayfee: case dustrelayfee:
if (changed()) { if (changed()) {
CAmount nNv = value.toLongLong(); CAmount nNv = value.toLongLong();

View File

@ -100,6 +100,7 @@ public:
maxscriptsize, maxscriptsize,
datacarriercost, // double datacarriercost, // double
datacarriersize, datacarriersize,
rejectnonstddatacarrier, // bool
dustrelayfee, dustrelayfee,
dustdynamic, // QString dustdynamic, // QString
blockmintxfee, blockmintxfee,