mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-12 19:20:42 +02:00
Qt/Options: Configure mempoolexpiry using rwconf
This commit is contained in:
parent
3d0f771518
commit
4a80bf0af1
@ -210,6 +210,11 @@ 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"));
|
||||
|
||||
mempoolexpiry = new QSpinBox(tabMempool);
|
||||
mempoolexpiry->setMinimum(1);
|
||||
mempoolexpiry->setMaximum(std::numeric_limits<int>::max());
|
||||
CreateOptionUI(verticalLayout_Mempool, mempoolexpiry, tr("Do not keep transactions in memory more than %s hours"));
|
||||
|
||||
QGroupBox * const groupBox_Spamfiltering = new QGroupBox(tabMempool);
|
||||
groupBox_Spamfiltering->setTitle(tr("Spam filtering"));
|
||||
QVBoxLayout * const verticalLayout_Spamfiltering = new QVBoxLayout(groupBox_Spamfiltering);
|
||||
@ -456,6 +461,7 @@ void OptionsDialog::setMapper()
|
||||
|
||||
mapper->addMapping(maxorphantx, OptionsModel::maxorphantx);
|
||||
mapper->addMapping(maxmempool, OptionsModel::maxmempool);
|
||||
mapper->addMapping(mempoolexpiry, OptionsModel::mempoolexpiry);
|
||||
|
||||
/* Window */
|
||||
#ifndef Q_OS_MACOS
|
||||
|
@ -91,6 +91,7 @@ private:
|
||||
QValueComboBox *mempoolreplacement;
|
||||
QSpinBox *maxorphantx;
|
||||
QSpinBox *maxmempool;
|
||||
QSpinBox *mempoolexpiry;
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_OPTIONSDIALOG_H
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <chainparams.h>
|
||||
#include <index/blockfilterindex.h>
|
||||
#include <interfaces/node.h>
|
||||
#include <kernel/mempool_options.h> // for DEFAULT_MAX_MEMPOOL_SIZE_MB
|
||||
#include <kernel/mempool_options.h> // for DEFAULT_MAX_MEMPOOL_SIZE_MB, DEFAULT_MEMPOOL_EXPIRY_HOURS
|
||||
#include <mapport.h>
|
||||
#include <net.h>
|
||||
#include <net_processing.h>
|
||||
@ -33,6 +33,8 @@
|
||||
#include <interfaces/wallet.h>
|
||||
#endif
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QLatin1Char>
|
||||
#include <QSettings>
|
||||
@ -614,6 +616,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 mempoolexpiry:
|
||||
return qlonglong(std::chrono::duration_cast<std::chrono::hours>(node().mempool().m_expiry).count());
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@ -965,6 +969,25 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
|
||||
}
|
||||
break;
|
||||
}
|
||||
case mempoolexpiry:
|
||||
{
|
||||
if (changed()) {
|
||||
const auto old_value = node().mempool().m_expiry;
|
||||
const std::chrono::hours new_value{value.toLongLong()};
|
||||
std::string strNv = value.toString().toStdString();
|
||||
node().mempool().m_expiry = new_value;
|
||||
gArgs.ForceSetArg("-mempoolexpiry", strNv);
|
||||
gArgs.ModifyRWConfigFile("mempoolexpiry", strNv);
|
||||
if (new_value < old_value) {
|
||||
LOCK(cs_main);
|
||||
auto node_ctx = node().context();
|
||||
assert(node_ctx && node_ctx->mempool && node_ctx->chainman);
|
||||
auto& active_chainstate = node_ctx->chainman->ActiveChainstate();
|
||||
LimitMempoolSize(*node_ctx->mempool, active_chainstate.CoinsTip());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ public:
|
||||
mempoolreplacement,
|
||||
maxorphantx,
|
||||
maxmempool,
|
||||
mempoolexpiry,
|
||||
OptionIDRowCount,
|
||||
};
|
||||
|
||||
|
@ -463,7 +463,7 @@ public:
|
||||
using Options = kernel::MemPoolOptions;
|
||||
|
||||
int64_t m_max_size_bytes;
|
||||
const std::chrono::seconds m_expiry;
|
||||
std::chrono::seconds m_expiry;
|
||||
const CFeeRate m_incremental_relay_feerate;
|
||||
const CFeeRate m_min_relay_feerate;
|
||||
const CFeeRate m_dust_relay_feerate;
|
||||
|
Loading…
Reference in New Issue
Block a user