Skip to content

Commit 4f3ea9f

Browse files
Retropexluke-jr
authored andcommitted
GUI/Options: Configure rejectparasites using settings
Co-authored-by: Luke Dashjr <[email protected]> Github-Pull: knots#78 Rebased-From: 78f1ec0
1 parent 4daa4fe commit 4f3ea9f

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

src/qt/optionsdialog.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
267267
verticalLayout_Spamfiltering->addWidget(rejectunknownscripts);
268268
FixTabOrder(rejectunknownscripts);
269269

270+
rejectparasites = new QCheckBox(groupBox_Spamfiltering);
271+
rejectparasites->setText(tr("Reject parasite transactions"));
272+
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."));
273+
verticalLayout_Spamfiltering->addWidget(rejectparasites);
274+
FixTabOrder(rejectparasites);
275+
270276
rejecttokens = new QCheckBox(groupBox_Spamfiltering);
271277
rejecttokens->setText(tr("Ignore transactions involving non-bitcoin token/asset overlay protocols"));
272278
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()
707713
mapper->addMapping(mempoolexpiry, OptionsModel::mempoolexpiry);
708714

709715
mapper->addMapping(rejectunknownscripts, OptionsModel::rejectunknownscripts);
716+
mapper->addMapping(rejectparasites, OptionsModel::rejectparasites);
710717
mapper->addMapping(rejecttokens, OptionsModel::rejecttokens);
711718
mapper->addMapping(rejectspkreuse, OptionsModel::rejectspkreuse);
712719
mapper->addMapping(minrelaytxfee, OptionsModel::minrelaytxfee);

src/qt/optionsdialog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ private Q_SLOTS:
109109
QSpinBox *mempoolexpiry;
110110

111111
QCheckBox *rejectunknownscripts;
112+
QCheckBox *rejectparasites;
112113
QCheckBox *rejecttokens;
113114
QCheckBox *rejectspkreuse;
114115
BitcoinAmountField *minrelaytxfee;

src/qt/optionsmodel.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
660660
return qlonglong(std::chrono::duration_cast<std::chrono::hours>(node().mempool().m_opts.expiry).count());
661661
case rejectunknownscripts:
662662
return node().mempool().m_opts.require_standard;
663+
case rejectparasites:
664+
return node().mempool().m_opts.reject_parasites;
663665
case rejecttokens:
664666
return node().mempool().m_opts.reject_tokens;
665667
case rejectspkreuse:
@@ -1117,6 +1119,15 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
11171119
}
11181120
break;
11191121
}
1122+
case rejectparasites:
1123+
{
1124+
if (changed()) {
1125+
const bool nv = value.toBool();
1126+
node().mempool().m_opts.reject_parasites = nv;
1127+
node().updateRwSetting("rejectparasites", nv);
1128+
}
1129+
break;
1130+
}
11201131
case rejecttokens:
11211132
{
11221133
if (changed()) {

src/qt/optionsmodel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class OptionsModel : public QAbstractListModel
8787
incrementalrelayfee,
8888
mempoolexpiry,
8989
rejectunknownscripts, // bool
90+
rejectparasites, // bool
9091
rejecttokens, // bool
9192
rejectspkreuse, // bool
9293
minrelaytxfee,

0 commit comments

Comments
 (0)