mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-28 13:02:38 +02:00
Qt/Options: Configure mempoolexpiry using rwconf
This commit is contained in:
parent
d6f4eb55f9
commit
8ae6db8db1
@ -214,6 +214,11 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
|
|||||||
maxmempool->setMaximum(std::numeric_limits<int>::max());
|
maxmempool->setMaximum(std::numeric_limits<int>::max());
|
||||||
CreateOptionUI(verticalLayout_Mempool, maxmempool, tr("Keep the transaction memory pool below %s MB"));
|
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);
|
QGroupBox * const groupBox_Spamfiltering = new QGroupBox(tabMempool);
|
||||||
groupBox_Spamfiltering->setTitle(tr("Spam filtering"));
|
groupBox_Spamfiltering->setTitle(tr("Spam filtering"));
|
||||||
QVBoxLayout * const verticalLayout_Spamfiltering = new QVBoxLayout(groupBox_Spamfiltering);
|
QVBoxLayout * const verticalLayout_Spamfiltering = new QVBoxLayout(groupBox_Spamfiltering);
|
||||||
@ -468,6 +473,7 @@ void OptionsDialog::setMapper()
|
|||||||
|
|
||||||
mapper->addMapping(maxorphantx, OptionsModel::maxorphantx);
|
mapper->addMapping(maxorphantx, OptionsModel::maxorphantx);
|
||||||
mapper->addMapping(maxmempool, OptionsModel::maxmempool);
|
mapper->addMapping(maxmempool, OptionsModel::maxmempool);
|
||||||
|
mapper->addMapping(mempoolexpiry, OptionsModel::mempoolexpiry);
|
||||||
|
|
||||||
/* Window */
|
/* Window */
|
||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
|
@ -91,6 +91,7 @@ private:
|
|||||||
QValueComboBox *mempoolreplacement;
|
QValueComboBox *mempoolreplacement;
|
||||||
QSpinBox *maxorphantx;
|
QSpinBox *maxorphantx;
|
||||||
QSpinBox *maxmempool;
|
QSpinBox *maxmempool;
|
||||||
|
QSpinBox *mempoolexpiry;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BITCOIN_QT_OPTIONSDIALOG_H
|
#endif // BITCOIN_QT_OPTIONSDIALOG_H
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <common/args.h>
|
#include <common/args.h>
|
||||||
#include <index/blockfilterindex.h>
|
#include <index/blockfilterindex.h>
|
||||||
#include <interfaces/node.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 <mapport.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <net_processing.h>
|
#include <net_processing.h>
|
||||||
@ -32,6 +32,7 @@
|
|||||||
#include <interfaces/wallet.h>
|
#include <interfaces/wallet.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
@ -640,6 +641,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
|
|||||||
return qlonglong(gArgs.GetIntArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS));
|
return qlonglong(gArgs.GetIntArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS));
|
||||||
case maxmempool:
|
case maxmempool:
|
||||||
return qlonglong(node().mempool().m_opts.max_size_bytes / 1'000'000);
|
return qlonglong(node().mempool().m_opts.max_size_bytes / 1'000'000);
|
||||||
|
case mempoolexpiry:
|
||||||
|
return qlonglong(std::chrono::duration_cast<std::chrono::hours>(node().mempool().m_opts.expiry).count());
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -992,6 +995,25 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case mempoolexpiry:
|
||||||
|
{
|
||||||
|
if (changed()) {
|
||||||
|
const auto old_value = node().mempool().m_opts.expiry;
|
||||||
|
const std::chrono::hours new_value{value.toLongLong()};
|
||||||
|
std::string strNv = value.toString().toStdString();
|
||||||
|
node().mempool().m_opts.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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,7 @@ public:
|
|||||||
mempoolreplacement,
|
mempoolreplacement,
|
||||||
maxorphantx,
|
maxorphantx,
|
||||||
maxmempool,
|
maxmempool,
|
||||||
|
mempoolexpiry,
|
||||||
OptionIDRowCount,
|
OptionIDRowCount,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user