mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-13 03:30:42 +02:00
Qt/Options: Configure maxorphantx using rwconf
This commit is contained in:
parent
0892562e43
commit
4dff308dc7
@ -520,6 +520,7 @@ public:
|
|||||||
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) const override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
|
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) const override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
|
||||||
std::vector<TxOrphanage::OrphanTxBase> GetOrphanTransactions() override EXCLUSIVE_LOCKS_REQUIRED(!m_tx_download_mutex);
|
std::vector<TxOrphanage::OrphanTxBase> GetOrphanTransactions() override EXCLUSIVE_LOCKS_REQUIRED(!m_tx_download_mutex);
|
||||||
PeerManagerInfo GetInfo() const override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
|
PeerManagerInfo GetInfo() const override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
|
||||||
|
void LimitOrphanTxSize(unsigned int nMaxOrphans) override EXCLUSIVE_LOCKS_REQUIRED(!m_tx_download_mutex);
|
||||||
void SendPings() override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
|
void SendPings() override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
|
||||||
void RelayTransaction(const uint256& txid, const uint256& wtxid) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
|
void RelayTransaction(const uint256& txid, const uint256& wtxid) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
|
||||||
void SetBestBlock(int height, std::chrono::seconds time) override
|
void SetBestBlock(int height, std::chrono::seconds time) override
|
||||||
@ -1952,6 +1953,13 @@ PeerManagerInfo PeerManagerImpl::GetInfo() const
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PeerManagerImpl::LimitOrphanTxSize(unsigned int nMaxOrphans)
|
||||||
|
{
|
||||||
|
LOCK(g_msgproc_mutex);
|
||||||
|
LOCK2(cs_main, m_tx_download_mutex);
|
||||||
|
m_orphanage.LimitOrphans(nMaxOrphans, m_rng);
|
||||||
|
}
|
||||||
|
|
||||||
int PeerManagerImpl::GetNumberOfPeersWithValidatedDownloads() const
|
int PeerManagerImpl::GetNumberOfPeersWithValidatedDownloads() const
|
||||||
{
|
{
|
||||||
AssertLockHeld(m_chainman.GetMutex());
|
AssertLockHeld(m_chainman.GetMutex());
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#define BITCOIN_NET_PROCESSING_H
|
#define BITCOIN_NET_PROCESSING_H
|
||||||
|
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
|
#include <threadsafety.h>
|
||||||
#include <txorphanage.h>
|
#include <txorphanage.h>
|
||||||
#include <validationinterface.h>
|
#include <validationinterface.h>
|
||||||
|
|
||||||
@ -95,6 +96,7 @@ public:
|
|||||||
|
|
||||||
/** Get statistics from node state */
|
/** Get statistics from node state */
|
||||||
virtual bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) const = 0;
|
virtual bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) const = 0;
|
||||||
|
virtual void LimitOrphanTxSize(unsigned int nMaxOrphans) = 0;
|
||||||
|
|
||||||
virtual std::vector<TxOrphanage::OrphanTxBase> GetOrphanTransactions() = 0;
|
virtual std::vector<TxOrphanage::OrphanTxBase> GetOrphanTransactions() = 0;
|
||||||
|
|
||||||
|
@ -202,6 +202,11 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
|
|||||||
mempoolreplacement->addItem(QString("with a higher mining fee (no opt-out)"), QVariant("fee,-optin"));
|
mempoolreplacement->addItem(QString("with a higher mining fee (no opt-out)"), QVariant("fee,-optin"));
|
||||||
CreateOptionUI(verticalLayout_Mempool, mempoolreplacement, tr("Transaction &replacement: %s"));
|
CreateOptionUI(verticalLayout_Mempool, mempoolreplacement, tr("Transaction &replacement: %s"));
|
||||||
|
|
||||||
|
maxorphantx = new QSpinBox(tabMempool);
|
||||||
|
maxorphantx->setMinimum(0);
|
||||||
|
maxorphantx->setMaximum(std::numeric_limits<int>::max());
|
||||||
|
CreateOptionUI(verticalLayout_Mempool, maxorphantx, tr("Keep at most %s unconnected transactions in memory"));
|
||||||
|
|
||||||
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);
|
||||||
@ -454,6 +459,8 @@ void OptionsDialog::setMapper()
|
|||||||
}
|
}
|
||||||
mempoolreplacement->setCurrentIndex(current_mempoolreplacement_index);
|
mempoolreplacement->setCurrentIndex(current_mempoolreplacement_index);
|
||||||
|
|
||||||
|
mapper->addMapping(maxorphantx, OptionsModel::maxorphantx);
|
||||||
|
|
||||||
/* Window */
|
/* Window */
|
||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
if (QSystemTrayIcon::isSystemTrayAvailable()) {
|
if (QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||||
|
@ -15,6 +15,7 @@ class QValidatedLineEdit;
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QBoxLayout;
|
class QBoxLayout;
|
||||||
class QDataWidgetMapper;
|
class QDataWidgetMapper;
|
||||||
|
class QSpinBox;
|
||||||
class QString;
|
class QString;
|
||||||
class QValueComboBox;
|
class QValueComboBox;
|
||||||
class QWidget;
|
class QWidget;
|
||||||
@ -88,6 +89,7 @@ private:
|
|||||||
void CreateOptionUI(QBoxLayout *, QWidget *, const QString& text);
|
void CreateOptionUI(QBoxLayout *, QWidget *, const QString& text);
|
||||||
|
|
||||||
QValueComboBox *mempoolreplacement;
|
QValueComboBox *mempoolreplacement;
|
||||||
|
QSpinBox *maxorphantx;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BITCOIN_QT_OPTIONSDIALOG_H
|
#endif // BITCOIN_QT_OPTIONSDIALOG_H
|
||||||
|
@ -635,6 +635,8 @@ QVariant OptionsModel::getOption(OptionID option, const std::string& suffix) con
|
|||||||
return gArgs.GetBoolArg("-peerblockfilters", DEFAULT_PEERBLOCKFILTERS);
|
return gArgs.GetBoolArg("-peerblockfilters", DEFAULT_PEERBLOCKFILTERS);
|
||||||
case mempoolreplacement:
|
case mempoolreplacement:
|
||||||
return CanonicalMempoolReplacement(*this);
|
return CanonicalMempoolReplacement(*this);
|
||||||
|
case maxorphantx:
|
||||||
|
return qlonglong(gArgs.GetIntArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS));
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -953,6 +955,21 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case maxorphantx:
|
||||||
|
{
|
||||||
|
if (changed()) {
|
||||||
|
unsigned int nMaxOrphanTx = gArgs.GetIntArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS);
|
||||||
|
unsigned int nNv = value.toLongLong();
|
||||||
|
std::string strNv = value.toString().toStdString();
|
||||||
|
gArgs.ForceSetArg("-maxorphantx", strNv);
|
||||||
|
gArgs.ModifyRWConfigFile("maxorphantx", strNv);
|
||||||
|
if (nNv < nMaxOrphanTx) {
|
||||||
|
assert(node().context() && node().context()->peerman);
|
||||||
|
node().context()->peerman->LimitOrphanTxSize(nNv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,7 @@ public:
|
|||||||
peerbloomfilters, // bool
|
peerbloomfilters, // bool
|
||||||
peerblockfilters, // bool
|
peerblockfilters, // bool
|
||||||
mempoolreplacement,
|
mempoolreplacement,
|
||||||
|
maxorphantx,
|
||||||
OptionIDRowCount,
|
OptionIDRowCount,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user