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:
<details>
<summary>git diff on 547fa52443cbb5e8ccfee993486f5ced8cdbb33b</summary>
diff --git a/src/node/peerman_args.cpp b/src/node/peerman_args.cpp
index efe4514271..53034d6277 100644
--- a/src/node/peerman_args.cpp
+++ b/src/node/peerman_args.cpp
@@ -2,6 +2,8 @@
#include <common/args.h>
#include <net_processing.h>
+#include <node/interface_ui.h>
+#include <util/translation.h>
#include <algorithm>
#include <limits>
@@ -13,10 +15,16 @@ void ApplyArgsManOptions(const ArgsManager& argsman, PeerManager::Options& optio
if (auto value{argsman.GetBoolArg("-txreconciliation")}) options.reconcile_txs = *value;
if (auto value{argsman.GetIntArg("-maxorphantx")}) {
+ if (*value > (100 * options.max_orphan_txs)) {
+ InitWarning(_("-maxorphantx is > 100x larger than the default value, affecting memory consumption"));
+ }
options.max_orphan_txs = uint32_t((std::clamp<int64_t>(*value, 0, std::numeric_limits<uint32_t>::max())));
}
if (auto value{argsman.GetIntArg("-blockreconstructionextratxn")}) {
+ if (*value > (100 * options.max_extra_txs)) {
+ InitWarning(_("-blockreconstructionextratxn is > 100x larger than the default value, affecting memory consumption"));
+ }
options.max_extra_txs = uint32_t((std::clamp<int64_t>(*value, 0, std::numeric_limits<uint32_t>::max())));
}
</details>
What do you think?