GUI/Options: Configure rejectparasites using settings

Co-authored-by: Luke Dashjr <luke_github1@dashjr.org>

Github-Pull: knots#78
Rebased-From: 78f1ec0f8d
This commit is contained in:
Léo Haf 2024-05-06 18:14:19 +02:00 committed by Luke Dashjr
parent 4daa4fe599
commit 4f3ea9f6ee
4 changed files with 20 additions and 0 deletions

View File

@ -267,6 +267,12 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
verticalLayout_Spamfiltering->addWidget(rejectunknownscripts);
FixTabOrder(rejectunknownscripts);
rejectparasites = new QCheckBox(groupBox_Spamfiltering);
rejectparasites->setText(tr("Reject parasite transactions"));
rejectparasites->setToolTip(tr("With this option enabled, transactions related to parasitic overlay protocols will be ignored. Parasites are transactions using Bitcoin as a technical infrastructure to animate other protocols, unrelated to ordinary money transfers."));
verticalLayout_Spamfiltering->addWidget(rejectparasites);
FixTabOrder(rejectparasites);
rejecttokens = new QCheckBox(groupBox_Spamfiltering);
rejecttokens->setText(tr("Ignore transactions involving non-bitcoin token/asset overlay protocols"));
rejecttokens->setToolTip(tr("With this option enabled, transactions involving non-bitcoin tokens/assets will not be relayed or mined by your node. Due to not having value, and some technical design flaws, token mints and transfers are often spammy and can bog down the network."));
@ -707,6 +713,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(mempoolexpiry, OptionsModel::mempoolexpiry);
mapper->addMapping(rejectunknownscripts, OptionsModel::rejectunknownscripts);
mapper->addMapping(rejectparasites, OptionsModel::rejectparasites);
mapper->addMapping(rejecttokens, OptionsModel::rejecttokens);
mapper->addMapping(rejectspkreuse, OptionsModel::rejectspkreuse);
mapper->addMapping(minrelaytxfee, OptionsModel::minrelaytxfee);

View File

@ -109,6 +109,7 @@ private:
QSpinBox *mempoolexpiry;
QCheckBox *rejectunknownscripts;
QCheckBox *rejectparasites;
QCheckBox *rejecttokens;
QCheckBox *rejectspkreuse;
BitcoinAmountField *minrelaytxfee;

View File

@ -660,6 +660,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
return qlonglong(std::chrono::duration_cast<std::chrono::hours>(node().mempool().m_opts.expiry).count());
case rejectunknownscripts:
return node().mempool().m_opts.require_standard;
case rejectparasites:
return node().mempool().m_opts.reject_parasites;
case rejecttokens:
return node().mempool().m_opts.reject_tokens;
case rejectspkreuse:
@ -1117,6 +1119,15 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
}
break;
}
case rejectparasites:
{
if (changed()) {
const bool nv = value.toBool();
node().mempool().m_opts.reject_parasites = nv;
node().updateRwSetting("rejectparasites", nv);
}
break;
}
case rejecttokens:
{
if (changed()) {

View File

@ -87,6 +87,7 @@ public:
incrementalrelayfee,
mempoolexpiry,
rejectunknownscripts, // bool
rejectparasites, // bool
rejecttokens, // bool
rejectspkreuse, // bool
minrelaytxfee,