Supplying a fee rate or an amount on the command line as an empty string, which currently parses as 0
seems fragile and confusing. See for example the confusion in #18214.
Fixes #18214
Since leading spaces are stripped by ParseMoney(…)
shouldn’t " "
(one space), two spaces, three spaces, etc. fail in the same way as ""
(empty string)?
In other words if (TrimString(s, " ").empty()) { return false; }
instead of if (s.empty()) { return false; }
?
bitcoind -regtest "-fallbackfee= "
harder to hit obviously but possible
@MarcoFalke It sure is but I’m not convinced that is even relevant: ParseMoney(…)
doesn’t come with any documented precondition that input must come from the command line :)
We should strive to write robust functions that gracefully and consistently handle all kinds of crazy and potentially malicious input, not functions that happen to work with the “happy path input” we currently feed them with. Robust is strictly better than fragile and future-proof is strictly better than at-the-moment-proof :)
If the intention here was to only fix the command-line handling of -fallbackfee=
then the emptiness check should not have been added to ParseMoney(…)
but to the code at the call site, no? :)