diff options
author | stickies-v <stickies-v@protonmail.com> | 2023-07-25 15:41:54 +0100 |
---|---|---|
committer | stickies-v <stickies-v@protonmail.com> | 2023-07-25 21:50:37 +0100 |
commit | e451d1e3c66350017da195335f428a96fdc7d840 (patch) | |
tree | 8a8a38b98c8c5170ef76c409499f5724db7dc5d5 /src/node | |
parent | aa89e04e07ca9ff51b1d7d310a11821c6ad963cf (diff) |
net processing: clamp -maxorphantx to uint32_t bounds
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/peerman_args.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/node/peerman_args.cpp b/src/node/peerman_args.cpp index e5868ead12..1a70ce96f1 100644 --- a/src/node/peerman_args.cpp +++ b/src/node/peerman_args.cpp @@ -3,6 +3,9 @@ #include <common/args.h> #include <net_processing.h> +#include <algorithm> +#include <limits> + namespace node { void ApplyArgsManOptions(const ArgsManager& argsman, PeerManager::Options& options) @@ -10,7 +13,7 @@ void ApplyArgsManOptions(const ArgsManager& argsman, PeerManager::Options& optio 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)); + options.max_orphan_txs = uint32_t((std::clamp<int64_t>(*value, 0, std::numeric_limits<uint32_t>::max()))); } if (auto value{argsman.GetIntArg("-blockreconstructionextratxn")}) { |