Qt/Options: Configure permitbarepubkey using settings

This commit is contained in:
Luke Dashjr 2025-02-04 02:45:23 +00:00
parent a933eb7cd8
commit 73fed175b7
4 changed files with 19 additions and 0 deletions

View File

@ -301,6 +301,12 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
limitdescendantsize->setMaximum(std::numeric_limits<int>::max());
CreateOptionUI(verticalLayout_Spamfiltering, limitdescendantsize, tr("Ignore transactions if any ancestor would have more than %s kilobytes of unconfirmed descendants."));
rejectbarepubkey = new QCheckBox(groupBox_Spamfiltering);
rejectbarepubkey->setText(tr("Ignore bare/exposed public keys (pay-to-IP)"));
rejectbarepubkey->setToolTip(tr("Spam is sometimes disguised to appear as if it is a deprecated pay-to-IP (bare pubkey) transaction, where the \"key\" is actually arbitrary data (not a real key) instead. Support for pay-to-IP was only ever supported by Satoshi's early Bitcoin wallet, which has been abandoned since 2011."));
verticalLayout_Spamfiltering->addWidget(rejectbarepubkey);
FixTabOrder(rejectbarepubkey);
rejectbaremultisig = new QCheckBox(groupBox_Spamfiltering);
rejectbaremultisig->setText(tr("Ignore bare/exposed \"multisig\" scripts"));
rejectbaremultisig->setToolTip(tr("Spam is sometimes disguised to appear as if it is an old-style N-of-M multi-party transaction, where most of the keys are really bogus. At the same time, legitimate multi-party transactions typically have always used P2SH format (which is not filtered by this option), which is more secure."));
@ -632,6 +638,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(limitancestorsize, OptionsModel::limitancestorsize);
mapper->addMapping(limitdescendantcount, OptionsModel::limitdescendantcount);
mapper->addMapping(limitdescendantsize, OptionsModel::limitdescendantsize);
mapper->addMapping(rejectbarepubkey, OptionsModel::rejectbarepubkey);
mapper->addMapping(rejectbaremultisig, OptionsModel::rejectbaremultisig);
mapper->addMapping(maxscriptsize, OptionsModel::maxscriptsize);
mapper->addMapping(datacarriercost, OptionsModel::datacarriercost);

View File

@ -114,6 +114,7 @@ private:
QSpinBox *limitancestorsize;
QSpinBox *limitdescendantcount;
QSpinBox *limitdescendantsize;
QCheckBox *rejectbarepubkey;
QCheckBox *rejectbaremultisig;
QSpinBox *maxscriptsize;
QSpinBox *datacarriersize;

View File

@ -673,6 +673,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
return qlonglong(node().mempool().m_opts.limits.descendant_count);
case limitdescendantsize:
return qlonglong(node().mempool().m_opts.limits.descendant_size_vbytes / 1'000);
case rejectbarepubkey:
return !node().mempool().m_opts.permit_bare_pubkey;
case rejectbaremultisig:
return !node().mempool().m_opts.permit_bare_multisig;
case maxscriptsize:
@ -1169,6 +1171,14 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
gArgs.ModifyRWConfigFile("limitdescendantsize", strNv);
}
break;
case rejectbarepubkey:
if (changed()) {
// The config and internal option is inverted
const bool nv = ! value.toBool();
node().mempool().m_opts.permit_bare_pubkey = nv;
node().updateRwSetting("permitbaremultisig", nv);
}
break;
case rejectbaremultisig:
if (changed()) {
// The config and internal option is inverted

View File

@ -95,6 +95,7 @@ public:
limitancestorsize,
limitdescendantcount,
limitdescendantsize,
rejectbarepubkey, // bool
rejectbaremultisig, // bool
maxscriptsize,
datacarriercost, // double