mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-13 03:30:42 +02:00
Qt/Options: Configure maxmempool using rwconf
This commit is contained in:
parent
4dff308dc7
commit
d6f4eb55f9
@ -13,6 +13,7 @@
|
|||||||
#include <qt/guiutil.h>
|
#include <qt/guiutil.h>
|
||||||
#include <qt/optionsmodel.h>
|
#include <qt/optionsmodel.h>
|
||||||
|
|
||||||
|
#include <common/args.h>
|
||||||
#include <common/system.h>
|
#include <common/system.h>
|
||||||
#include <index/blockfilterindex.h>
|
#include <index/blockfilterindex.h>
|
||||||
#include <interfaces/node.h>
|
#include <interfaces/node.h>
|
||||||
@ -20,8 +21,8 @@
|
|||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
#include <outputtype.h>
|
#include <outputtype.h>
|
||||||
#include <txdb.h>
|
#include <txdb.h>
|
||||||
|
#include <txmempool.h> // for maxmempoolMinimum
|
||||||
#include <util/strencodings.h>
|
#include <util/strencodings.h>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -207,6 +208,12 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
|
|||||||
maxorphantx->setMaximum(std::numeric_limits<int>::max());
|
maxorphantx->setMaximum(std::numeric_limits<int>::max());
|
||||||
CreateOptionUI(verticalLayout_Mempool, maxorphantx, tr("Keep at most %s unconnected transactions in memory"));
|
CreateOptionUI(verticalLayout_Mempool, maxorphantx, tr("Keep at most %s unconnected transactions in memory"));
|
||||||
|
|
||||||
|
maxmempool = new QSpinBox(tabMempool);
|
||||||
|
const int64_t nMempoolSizeMinMB = maxmempoolMinimumBytes(gArgs.GetIntArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT_KVB) * 1'000) / 1'000'000;
|
||||||
|
maxmempool->setMinimum(nMempoolSizeMinMB);
|
||||||
|
maxmempool->setMaximum(std::numeric_limits<int>::max());
|
||||||
|
CreateOptionUI(verticalLayout_Mempool, maxmempool, tr("Keep the transaction memory pool below %s MB"));
|
||||||
|
|
||||||
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);
|
||||||
@ -460,6 +467,7 @@ void OptionsDialog::setMapper()
|
|||||||
mempoolreplacement->setCurrentIndex(current_mempoolreplacement_index);
|
mempoolreplacement->setCurrentIndex(current_mempoolreplacement_index);
|
||||||
|
|
||||||
mapper->addMapping(maxorphantx, OptionsModel::maxorphantx);
|
mapper->addMapping(maxorphantx, OptionsModel::maxorphantx);
|
||||||
|
mapper->addMapping(maxmempool, OptionsModel::maxmempool);
|
||||||
|
|
||||||
/* Window */
|
/* Window */
|
||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
|
@ -90,6 +90,7 @@ private:
|
|||||||
|
|
||||||
QValueComboBox *mempoolreplacement;
|
QValueComboBox *mempoolreplacement;
|
||||||
QSpinBox *maxorphantx;
|
QSpinBox *maxorphantx;
|
||||||
|
QSpinBox *maxmempool;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BITCOIN_QT_OPTIONSDIALOG_H
|
#endif // BITCOIN_QT_OPTIONSDIALOG_H
|
||||||
|
@ -14,6 +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 <mapport.h>
|
#include <mapport.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <net_processing.h>
|
#include <net_processing.h>
|
||||||
@ -637,6 +638,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
|
|||||||
return CanonicalMempoolReplacement(*this);
|
return CanonicalMempoolReplacement(*this);
|
||||||
case maxorphantx:
|
case maxorphantx:
|
||||||
return qlonglong(gArgs.GetIntArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS));
|
return qlonglong(gArgs.GetIntArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS));
|
||||||
|
case maxmempool:
|
||||||
|
return qlonglong(node().mempool().m_opts.max_size_bytes / 1'000'000);
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -970,6 +973,25 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case maxmempool:
|
||||||
|
{
|
||||||
|
if (changed()) {
|
||||||
|
long long nOldValue = node().mempool().m_opts.max_size_bytes;
|
||||||
|
long long nNv = value.toLongLong();
|
||||||
|
std::string strNv = value.toString().toStdString();
|
||||||
|
node().mempool().m_opts.max_size_bytes = nNv * 1'000'000;
|
||||||
|
gArgs.ForceSetArg("-maxmempool", strNv);
|
||||||
|
gArgs.ModifyRWConfigFile("maxmempool", strNv);
|
||||||
|
if (nNv < nOldValue) {
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@ public:
|
|||||||
peerblockfilters, // bool
|
peerblockfilters, // bool
|
||||||
mempoolreplacement,
|
mempoolreplacement,
|
||||||
maxorphantx,
|
maxorphantx,
|
||||||
|
maxmempool,
|
||||||
OptionIDRowCount,
|
OptionIDRowCount,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user