I’m not really keen on setting limits. I don’t know what good values would be, and ultimately it’s not a huge problem if the value is too high. I think issuing a warning could be sensible as it does have meaningful impact, but I don’t have a strong view. Too many warnings/popups is also not great UX.
For example, this would log a warning in the console, and on qt issue a warning pop-up if a value > 100x default value is entered:
0diff --git a/src/node/peerman_args.cpp b/src/node/peerman_args.cpp
1index efe4514271..53034d6277 100644
2--- a/src/node/peerman_args.cpp
3+++ b/src/node/peerman_args.cpp
4@@ -2,6 +2,8 @@
5
6 #include <common/args.h>
7 #include <net_processing.h>
8+#include <node/interface_ui.h>
9+#include <util/translation.h>
10
11 #include <algorithm>
12 #include <limits>
13@@ -13,10 +15,16 @@ void ApplyArgsManOptions(const ArgsManager& argsman, PeerManager::Options& optio
14 if (auto value{argsman.GetBoolArg("-txreconciliation")}) options.reconcile_txs = *value;
15
16 if (auto value{argsman.GetIntArg("-maxorphantx")}) {
17+ if (*value > (100 * options.max_orphan_txs)) {
18+ InitWarning(_("-maxorphantx is > 100x larger than the default value, affecting memory consumption"));
19+ }
20 options.max_orphan_txs = uint32_t((std::clamp<int64_t>(*value, 0, std::numeric_limits<uint32_t>::max())));
21 }
22
23 if (auto value{argsman.GetIntArg("-blockreconstructionextratxn")}) {
24+ if (*value > (100 * options.max_extra_txs)) {
25+ InitWarning(_("-blockreconstructionextratxn is > 100x larger than the default value, affecting memory consumption"));
26+ }
27 options.max_extra_txs = uint32_t((std::clamp<int64_t>(*value, 0, std::numeric_limits<uint32_t>::max())));
28 }
29
What do you think?