mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-12 19:20:42 +02:00
GUI/Options: Configure datacarriercost using settings
This commit is contained in:
parent
1e97b0ced4
commit
deffdb4461
@ -32,6 +32,7 @@
|
||||
#include <QBoxLayout>
|
||||
#include <QDataWidgetMapper>
|
||||
#include <QDir>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QFontDialog>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
@ -308,6 +309,20 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
|
||||
datacarriersize->setToolTip(tr("While Bitcoin itself does not support attaching arbitrary data to transactions, despite that various methods for disguising it have been devised over the years. Since it is sometimes impractical to detect small spam disguised as ordinary transactions, it is sometimes considered beneficial to tolerate certain kinds of less harmful data attachments."));
|
||||
CreateOptionUI(verticalLayout_Spamfiltering, datacarriersize, tr("Ignore transactions with additional data larger than %s bytes."));
|
||||
|
||||
datacarriercost = new QDoubleSpinBox(groupBox_Spamfiltering);
|
||||
datacarriercost->setDecimals(2);
|
||||
datacarriercost->setStepType(QAbstractSpinBox::DefaultStepType);
|
||||
datacarriercost->setSingleStep(0.25);
|
||||
datacarriercost->setMinimum(0.25);
|
||||
datacarriercost->setMaximum(MAX_BLOCK_SERIALIZED_SIZE);
|
||||
datacarriercost->setToolTip(tr("As an alternative to, or in addition to, limiting the size of disguised data, you can also configure how it is accounted for in comparison to legitimate transaction data. For example, 1 vbyte per actual byte would count it as equivalent to ordinary transaction data; 0.25 vB/B would allow it to benefit from the so-called \"segwit discount\"; or 2 vB/B would establish a bias toward legitimate transactions."));
|
||||
CreateOptionUI(verticalLayout_Spamfiltering, datacarriercost, tr("Weigh embedded data as %s virtual bytes per actual byte."));
|
||||
connect(datacarriercost, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=](double d){
|
||||
const double w = d * 4;
|
||||
const double wf = floor(w);
|
||||
if (w != wf) datacarriercost->setValue(wf / 4);
|
||||
});
|
||||
|
||||
dustrelayfee = new BitcoinAmountField(groupBox_Spamfiltering);
|
||||
CreateOptionUI(verticalLayout_Spamfiltering, dustrelayfee, tr("Ignore transactions with values that would cost more to spend at a fee rate of %s per kB."));
|
||||
|
||||
@ -600,6 +615,7 @@ void OptionsDialog::setMapper()
|
||||
mapper->addMapping(limitdescendantcount, OptionsModel::limitdescendantcount);
|
||||
mapper->addMapping(limitdescendantsize, OptionsModel::limitdescendantsize);
|
||||
mapper->addMapping(rejectbaremultisig, OptionsModel::rejectbaremultisig);
|
||||
mapper->addMapping(datacarriercost, OptionsModel::datacarriercost);
|
||||
mapper->addMapping(datacarriersize, OptionsModel::datacarriersize);
|
||||
mapper->addMapping(dustrelayfee, OptionsModel::dustrelayfee);
|
||||
|
||||
|
@ -17,6 +17,7 @@ QT_BEGIN_NAMESPACE
|
||||
class QBoxLayout;
|
||||
class QCheckBox;
|
||||
class QDataWidgetMapper;
|
||||
class QDoubleSpinBox;
|
||||
class QSpinBox;
|
||||
class QString;
|
||||
class QValueComboBox;
|
||||
@ -115,6 +116,7 @@ private:
|
||||
QSpinBox *limitdescendantsize;
|
||||
QCheckBox *rejectbaremultisig;
|
||||
QSpinBox *datacarriersize;
|
||||
QDoubleSpinBox *datacarriercost;
|
||||
BitcoinAmountField *dustrelayfee;
|
||||
|
||||
BitcoinAmountField *blockmintxfee;
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <qt/guiutil.h>
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <consensus/consensus.h>
|
||||
#include <index/blockfilterindex.h>
|
||||
#include <interfaces/node.h>
|
||||
#include <kernel/mempool_options.h> // for DEFAULT_MAX_MEMPOOL_SIZE_MB, DEFAULT_MEMPOOL_EXPIRY_HOURS
|
||||
@ -70,6 +71,7 @@ static const char* SettingName(OptionsModel::OptionID option)
|
||||
case OptionsModel::ProxyPortTor: return "onion";
|
||||
case OptionsModel::ProxyUseTor: return "onion";
|
||||
case OptionsModel::Language: return "lang";
|
||||
case OptionsModel::datacarriercost: return "datacarriercost";
|
||||
default: throw std::logic_error(strprintf("GUI option %i has no corresponding node setting.", option));
|
||||
}
|
||||
}
|
||||
@ -293,6 +295,7 @@ bool OptionsModel::Init(bilingual_str& error)
|
||||
// These are shared with the core or have a command-line parameter
|
||||
// and we want command-line parameters to overwrite the GUI settings.
|
||||
for (OptionID option : {DatabaseCache, ThreadsScriptVerif, SpendZeroConfChange, ExternalSignerPath, MapPortUPnP,
|
||||
datacarriercost,
|
||||
MapPortNatpmp, Listen, Server, PruneTristate, ProxyUse, ProxyUseTor, Language}) {
|
||||
// isSettingIgnored will have a false positive here during first-run prune changes
|
||||
if (option == PruneTristate && m_prune_forced_by_gui) continue;
|
||||
@ -648,6 +651,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
|
||||
return qlonglong(node().mempool().m_limits.descendant_size_vbytes / 1'000);
|
||||
case rejectbaremultisig:
|
||||
return !node().mempool().m_permit_bare_multisig;
|
||||
case datacarriercost:
|
||||
return double(::g_weight_per_data_byte) / WITNESS_SCALE_FACTOR;
|
||||
case datacarriersize:
|
||||
return qlonglong(node().mempool().m_max_datacarrier_bytes.value_or(0));
|
||||
case dustrelayfee:
|
||||
@ -1145,6 +1150,13 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
|
||||
gArgs.ModifyRWConfigFile("permitbaremultisig", strprintf("%d", fNewValue));
|
||||
}
|
||||
break;
|
||||
case datacarriercost:
|
||||
if (changed()) {
|
||||
const double nNewSize = value.toDouble();
|
||||
update(nNewSize);
|
||||
::g_weight_per_data_byte = nNewSize * WITNESS_SCALE_FACTOR;
|
||||
}
|
||||
break;
|
||||
case datacarriersize:
|
||||
if (changed()) {
|
||||
const int nNewSize = value.toInt();
|
||||
|
@ -96,6 +96,7 @@ public:
|
||||
limitdescendantcount,
|
||||
limitdescendantsize,
|
||||
rejectbaremultisig, // bool
|
||||
datacarriercost, // double
|
||||
datacarriersize,
|
||||
dustrelayfee,
|
||||
blockmintxfee,
|
||||
|
Loading…
Reference in New Issue
Block a user