GUI/Options: Configure rejecttokens using settings

This commit is contained in:
Luke Dashjr 2024-05-06 20:39:23 +00:00
parent f19978f20d
commit 4daa4fe599
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);
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."));
verticalLayout_Spamfiltering->addWidget(rejecttokens);
FixTabOrder(rejecttokens);
rejectspkreuse = new QCheckBox(groupBox_Spamfiltering);
rejectspkreuse->setText(tr("Disallow most address reuse"));
rejectspkreuse->setToolTip(tr("With this option enabled, your memory pool will only allow each unique payment destination to be used once, effectively deprioritising address reuse. Address reuse is not technically supported, and harms the privacy of all Bitcoin users. It also has limited real-world utility, and has been known to be common with spam."));
@ -701,6 +707,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(mempoolexpiry, OptionsModel::mempoolexpiry);
mapper->addMapping(rejectunknownscripts, OptionsModel::rejectunknownscripts);
mapper->addMapping(rejecttokens, OptionsModel::rejecttokens);
mapper->addMapping(rejectspkreuse, OptionsModel::rejectspkreuse);
mapper->addMapping(minrelaytxfee, OptionsModel::minrelaytxfee);
mapper->addMapping(bytespersigop, OptionsModel::bytespersigop);

View File

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

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 rejecttokens:
return node().mempool().m_opts.reject_tokens;
case rejectspkreuse:
return f_rejectspkreuse;
case minrelaytxfee:
@ -1115,6 +1117,15 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
}
break;
}
case rejecttokens:
{
if (changed()) {
const bool nv = value.toBool();
node().mempool().m_opts.reject_tokens = nv;
node().updateRwSetting("rejecttokens", nv);
}
break;
}
case rejectspkreuse:
if (changed()) {
const bool fNewValue = value.toBool();

View File

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