mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-05-17 23:56:39 +00:00
[net processing] Move -maxorphantx to PeerManager::Options
This commit is contained in:
parent
fa9e6d80d1
commit
567c4e0b6a
@ -4238,8 +4238,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
|||||||
m_txrequest.ForgetTxHash(tx.GetWitnessHash());
|
m_txrequest.ForgetTxHash(tx.GetWitnessHash());
|
||||||
|
|
||||||
// DoS prevention: do not allow m_orphanage to grow unbounded (see CVE-2012-3789)
|
// DoS prevention: do not allow m_orphanage to grow unbounded (see CVE-2012-3789)
|
||||||
unsigned int nMaxOrphanTx = (unsigned int)std::max((int64_t)0, gArgs.GetIntArg("-maxorphantx", DEFAULT_MAX_ORPHAN_TRANSACTIONS));
|
m_orphanage.LimitOrphans(m_opts.max_orphan_txs);
|
||||||
m_orphanage.LimitOrphans(nMaxOrphanTx);
|
|
||||||
} else {
|
} else {
|
||||||
LogPrint(BCLog::MEMPOOL, "not keeping orphan with rejected parents %s\n",tx.GetHash().ToString());
|
LogPrint(BCLog::MEMPOOL, "not keeping orphan with rejected parents %s\n",tx.GetHash().ToString());
|
||||||
// We will continue to reject this tx since it has rejected
|
// We will continue to reject this tx since it has rejected
|
||||||
|
@ -49,6 +49,7 @@ public:
|
|||||||
/** Whether this node is running in -blocksonly mode */
|
/** Whether this node is running in -blocksonly mode */
|
||||||
bool ignore_incoming_txs{DEFAULT_BLOCKSONLY};
|
bool ignore_incoming_txs{DEFAULT_BLOCKSONLY};
|
||||||
bool reconcile_txs{DEFAULT_TXRECONCILIATION_ENABLE};
|
bool reconcile_txs{DEFAULT_TXRECONCILIATION_ENABLE};
|
||||||
|
uint32_t max_orphan_txs{DEFAULT_MAX_ORPHAN_TRANSACTIONS};
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::unique_ptr<PeerManager> make(CConnman& connman, AddrMan& addrman,
|
static std::unique_ptr<PeerManager> make(CConnman& connman, AddrMan& addrman,
|
||||||
|
@ -7,7 +7,11 @@ namespace node {
|
|||||||
|
|
||||||
void ApplyArgsManOptions(const ArgsManager& argsman, PeerManager::Options& options)
|
void ApplyArgsManOptions(const ArgsManager& argsman, PeerManager::Options& options)
|
||||||
{
|
{
|
||||||
if(auto value{argsman.GetBoolArg("-txreconciliation")}) options.reconcile_txs = *value;
|
if (auto value{argsman.GetBoolArg("-txreconciliation")}) options.reconcile_txs = *value;
|
||||||
|
|
||||||
|
if (auto value{argsman.GetIntArg("-maxorphantx")}) {
|
||||||
|
options.max_orphan_txs = uint32_t(std::max(int64_t{0}, *value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace node
|
} // namespace node
|
||||||
|
Loading…
x
Reference in New Issue
Block a user