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); verticalLayout_Spamfiltering->addWidget(rejectunknownscripts);
FixTabOrder(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 = new QCheckBox(groupBox_Spamfiltering);
rejectspkreuse->setText(tr("Disallow most address reuse")); 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.")); 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(mempoolexpiry, OptionsModel::mempoolexpiry);
mapper->addMapping(rejectunknownscripts, OptionsModel::rejectunknownscripts); mapper->addMapping(rejectunknownscripts, OptionsModel::rejectunknownscripts);
mapper->addMapping(rejecttokens, OptionsModel::rejecttokens);
mapper->addMapping(rejectspkreuse, OptionsModel::rejectspkreuse); mapper->addMapping(rejectspkreuse, OptionsModel::rejectspkreuse);
mapper->addMapping(minrelaytxfee, OptionsModel::minrelaytxfee); mapper->addMapping(minrelaytxfee, OptionsModel::minrelaytxfee);
mapper->addMapping(bytespersigop, OptionsModel::bytespersigop); mapper->addMapping(bytespersigop, OptionsModel::bytespersigop);

View File

@ -109,6 +109,7 @@ private:
QSpinBox *mempoolexpiry; QSpinBox *mempoolexpiry;
QCheckBox *rejectunknownscripts; QCheckBox *rejectunknownscripts;
QCheckBox *rejecttokens;
QCheckBox *rejectspkreuse; QCheckBox *rejectspkreuse;
BitcoinAmountField *minrelaytxfee; BitcoinAmountField *minrelaytxfee;
QSpinBox *bytespersigop, *bytespersigopstrict; 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()); return qlonglong(std::chrono::duration_cast<std::chrono::hours>(node().mempool().m_opts.expiry).count());
case rejectunknownscripts: case rejectunknownscripts:
return node().mempool().m_opts.require_standard; return node().mempool().m_opts.require_standard;
case rejecttokens:
return node().mempool().m_opts.reject_tokens;
case rejectspkreuse: case rejectspkreuse:
return f_rejectspkreuse; return f_rejectspkreuse;
case minrelaytxfee: case minrelaytxfee:
@ -1115,6 +1117,15 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
} }
break; break;
} }
case rejecttokens:
{
if (changed()) {
const bool nv = value.toBool();
node().mempool().m_opts.reject_tokens = nv;
node().updateRwSetting("rejecttokens", nv);
}
break;
}
case rejectspkreuse: case rejectspkreuse:
if (changed()) { if (changed()) {
const bool fNewValue = value.toBool(); const bool fNewValue = value.toBool();

View File

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