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
8c9b30de19
commit
a46bb3410f
@ -517,6 +517,7 @@ public:
|
|||||||
std::optional<std::string> FetchBlock(NodeId peer_id, const uint256& hash, const CBlockIndex* block_index) override
|
std::optional<std::string> FetchBlock(NodeId peer_id, const uint256& hash, const CBlockIndex* block_index) override
|
||||||
EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
|
EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex);
|
||||||
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);
|
||||||
|
void LimitOrphanTxSize(unsigned int nMaxOrphans) override;
|
||||||
bool IgnoresIncomingTxs() override { return m_ignore_incoming_txs; }
|
bool IgnoresIncomingTxs() override { return m_ignore_incoming_txs; }
|
||||||
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);
|
||||||
@ -1673,6 +1674,12 @@ bool PeerManagerImpl::GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) c
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PeerManagerImpl::LimitOrphanTxSize(unsigned int nMaxOrphans)
|
||||||
|
{
|
||||||
|
LOCK(cs_main);
|
||||||
|
m_orphanage.LimitOrphans(nMaxOrphans);
|
||||||
|
}
|
||||||
|
|
||||||
int PeerManagerImpl::GetNumberOfPeersWithValidatedDownloads()
|
int PeerManagerImpl::GetNumberOfPeersWithValidatedDownloads()
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#define BITCOIN_NET_PROCESSING_H
|
#define BITCOIN_NET_PROCESSING_H
|
||||||
|
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
|
#include <threadsafety.h>
|
||||||
#include <validationinterface.h>
|
#include <validationinterface.h>
|
||||||
|
|
||||||
class AddrMan;
|
class AddrMan;
|
||||||
@ -63,6 +64,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;
|
||||||
|
|
||||||
/** Whether this node ignores txs received over p2p. */
|
/** Whether this node ignores txs received over p2p. */
|
||||||
virtual bool IgnoresIncomingTxs() = 0;
|
virtual bool IgnoresIncomingTxs() = 0;
|
||||||
|
@ -198,6 +198,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);
|
||||||
@ -442,6 +447,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
|
||||||
|
@ -609,6 +609,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();
|
||||||
}
|
}
|
||||||
@ -926,6 +928,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