aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordergoegge <n.goeggi@gmail.com>2023-04-20 13:33:11 +0200
committerdergoegge <n.goeggi@gmail.com>2023-07-24 18:35:30 +0200
commit567c4e0b6a3fadd2fd1be732076026bf491519b2 (patch)
tree6a661252af69d55b0a1c5a5b711933e330501abd
parentfa9e6d80d1c55f8b1bb2691bfd67e8c2b7189b38 (diff)
[net processing] Move -maxorphantx to PeerManager::Options
-rw-r--r--src/net_processing.cpp3
-rw-r--r--src/net_processing.h1
-rw-r--r--src/node/peerman_args.cpp6
3 files changed, 7 insertions, 3 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index a1889ae2b5..f061f981f2 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -4238,8 +4238,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
m_txrequest.ForgetTxHash(tx.GetWitnessHash());
// 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(nMaxOrphanTx);
+ m_orphanage.LimitOrphans(m_opts.max_orphan_txs);
} else {
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
diff --git a/src/net_processing.h b/src/net_processing.h
index 87c65baf01..422bf6879b 100644
--- a/src/net_processing.h
+++ b/src/net_processing.h
@@ -49,6 +49,7 @@ public:
/** Whether this node is running in -blocksonly mode */
bool ignore_incoming_txs{DEFAULT_BLOCKSONLY};
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,
diff --git a/src/node/peerman_args.cpp b/src/node/peerman_args.cpp
index b1242d0fdf..8a1da693f4 100644
--- a/src/node/peerman_args.cpp
+++ b/src/node/peerman_args.cpp
@@ -7,7 +7,11 @@ namespace node {
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