Qt/Options: Configure incrementalrelayfee using rwconf

This commit is contained in:
Luke Dashjr 2017-02-07 23:53:41 +00:00
parent b0ed9c2b22
commit 21fb3f523a
5 changed files with 31 additions and 2 deletions

View File

@ -49,7 +49,12 @@
void OptionsDialog::FixTabOrder(QWidget * const o)
{
setTabOrder(prevwidget, o);
BitcoinAmountField * const af = qobject_cast<BitcoinAmountField *>(o);
if (af) {
af->setupTabChain(prevwidget);
} else {
setTabOrder(prevwidget, o);
}
prevwidget = o;
}
@ -232,6 +237,10 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
maxmempool->setMaximum(std::numeric_limits<int>::max());
CreateOptionUI(verticalLayout_Mempool, maxmempool, tr("Keep the transaction memory pool below %s MB"));
incrementalrelayfee = new BitcoinAmountField(tabMempool);
connect(incrementalrelayfee, SIGNAL(valueChanged()), this, SLOT(incrementalrelayfee_changed()));
CreateOptionUI(verticalLayout_Mempool, incrementalrelayfee, tr("Require transaction fees to be at least %s per kB higher than transactions they are replacing."));
mempoolexpiry = new QSpinBox(tabMempool);
mempoolexpiry->setMinimum(1);
mempoolexpiry->setMaximum(std::numeric_limits<int>::max());
@ -563,6 +572,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(maxorphantx, OptionsModel::maxorphantx);
mapper->addMapping(maxmempool, OptionsModel::maxmempool);
mapper->addMapping(incrementalrelayfee, OptionsModel::incrementalrelayfee);
mapper->addMapping(mempoolexpiry, OptionsModel::mempoolexpiry);
mapper->addMapping(rejectunknownscripts, OptionsModel::rejectunknownscripts);
@ -614,6 +624,13 @@ void OptionsDialog::setOkButtonState(bool fState)
ui->okButton->setEnabled(fState);
}
void OptionsDialog::incrementalrelayfee_changed()
{
if (incrementalrelayfee->value() > minrelaytxfee->value()) {
minrelaytxfee->setValue(incrementalrelayfee->value());
}
}
void OptionsDialog::blockmaxsize_changed(int i)
{
if (blockprioritysize->value() > i) {

View File

@ -76,6 +76,7 @@ private Q_SLOTS:
void updateDefaultProxyNets();
void checkLineEdit();
void incrementalrelayfee_changed();
void blockmaxsize_changed(int);
void blockmaxsize_increase(int);
void blockmaxweight_changed(int);
@ -100,6 +101,7 @@ private:
QValueComboBox *mempoolreplacement;
QSpinBox *maxorphantx;
BitcoinAmountField *incrementalrelayfee;
QSpinBox *maxmempool;
QSpinBox *mempoolexpiry;

View File

@ -622,6 +622,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
return qlonglong(gArgs.GetIntArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS));
case maxmempool:
return qlonglong(node().mempool().m_max_size_bytes / 1'000'000);
case incrementalrelayfee:
return qlonglong(node().mempool().m_incremental_relay_feerate.GetFeePerK());
case mempoolexpiry:
return qlonglong(std::chrono::duration_cast<std::chrono::hours>(node().mempool().m_expiry).count());
case rejectunknownscripts:
@ -1021,6 +1023,13 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
}
break;
}
case incrementalrelayfee:
if (changed()) {
CAmount nNv = value.toLongLong();
gArgs.ModifyRWConfigFile("incrementalrelayfee", FormatMoney(nNv));
node().mempool().m_incremental_relay_feerate = CFeeRate(nNv);
}
break;
case mempoolexpiry:
{
if (changed()) {

View File

@ -84,6 +84,7 @@ public:
mempoolreplacement,
maxorphantx,
maxmempool,
incrementalrelayfee,
mempoolexpiry,
rejectunknownscripts, // bool
minrelaytxfee,

View File

@ -464,7 +464,7 @@ public:
int64_t m_max_size_bytes;
std::chrono::seconds m_expiry;
const CFeeRate m_incremental_relay_feerate;
CFeeRate m_incremental_relay_feerate;
CFeeRate m_min_relay_feerate;
const CFeeRate m_dust_relay_feerate;
bool m_permit_bare_multisig;