diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index bb4b0fc173..0455c81f3b 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -219,7 +219,11 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet) groupBox_Spamfiltering->setTitle(tr("Spam filtering")); QVBoxLayout * const verticalLayout_Spamfiltering = new QVBoxLayout(groupBox_Spamfiltering); - // TODO + rejectunknownscripts = new QCheckBox(groupBox_Spamfiltering); + rejectunknownscripts->setText(tr("Ignore unrecognised receiver scripts")); + rejectunknownscripts->setToolTip(tr("With this option enabled, unrecognised receiver (\"pubkey\") scripts will be ignored. Unrecognisable scripts could be used to bypass further spam filters. If your software is outdated, they may also be used to trick you into thinking you were sent bitcoins that will never confirm.")); + verticalLayout_Spamfiltering->addWidget(rejectunknownscripts); + FixTabOrder(rejectunknownscripts); verticalLayout_Mempool->addWidget(groupBox_Spamfiltering); @@ -463,6 +467,8 @@ void OptionsDialog::setMapper() mapper->addMapping(maxmempool, OptionsModel::maxmempool); mapper->addMapping(mempoolexpiry, OptionsModel::mempoolexpiry); + mapper->addMapping(rejectunknownscripts, OptionsModel::rejectunknownscripts); + /* Window */ #ifndef Q_OS_MACOS if (QSystemTrayIcon::isSystemTrayAvailable()) { diff --git a/src/qt/optionsdialog.h b/src/qt/optionsdialog.h index dd3042a721..96ff7f6296 100644 --- a/src/qt/optionsdialog.h +++ b/src/qt/optionsdialog.h @@ -14,6 +14,7 @@ class QValidatedLineEdit; QT_BEGIN_NAMESPACE class QBoxLayout; +class QCheckBox; class QDataWidgetMapper; class QSpinBox; class QString; @@ -92,6 +93,8 @@ private: QSpinBox *maxorphantx; QSpinBox *maxmempool; QSpinBox *mempoolexpiry; + + QCheckBox *rejectunknownscripts; }; #endif // BITCOIN_QT_OPTIONSDIALOG_H diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 76b41b9eee..871432160e 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -618,6 +618,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con return qlonglong(node().mempool().m_max_size_bytes / 1'000'000); case mempoolexpiry: return qlonglong(std::chrono::duration_cast(node().mempool().m_expiry).count()); + case rejectunknownscripts: + return node().mempool().m_require_standard; default: return QVariant(); } @@ -988,6 +990,16 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std:: } break; } + case rejectunknownscripts: + { + if (changed()) { + const bool fNewValue = value.toBool(); + node().mempool().m_require_standard = fNewValue; + // This option is inverted in the config: + gArgs.ModifyRWConfigFile("acceptnonstdtxn", strprintf("%d", ! fNewValue)); + } + break; + } default: break; } diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index df760517f7..35b8437703 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -84,6 +84,7 @@ public: maxorphantx, maxmempool, mempoolexpiry, + rejectunknownscripts, // bool OptionIDRowCount, }; diff --git a/src/txmempool.h b/src/txmempool.h index fdaab1e10f..5e2eb0d5fe 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -470,7 +470,7 @@ public: const bool m_permit_bare_multisig; const std::optional m_max_datacarrier_bytes; bool m_datacarrier_fullcount; - const bool m_require_standard; + bool m_require_standard; RBFPolicy m_rbf_policy; const Limits m_limits;