Can be tested by
- running the included test against an old binary (compiled without this patch)
- calling
setban 1 "add" 3 4 5 6 7 8 9 0in the gui
Can be tested by
setban 1 "add" 3 4 5 6 7 8 9 0 in the gui286 | @@ -287,6 +287,16 @@ std::string RPCExamples::ToDescriptionString() const 287 | return m_examples.empty() ? m_examples : "\nExamples:\n" + m_examples; 288 | } 289 | 290 | +bool RPCHelpMan::IsValidNumArgs(size_t num_args) const 291 | +{ 292 | + size_t num_required_args = 0; 293 | + for (size_t i = 0; i < m_args.size();) { 294 | + if (!m_args.at(i++).IsOptional()) {
👀
Could reverse the loop and break on first optional?
Done
Tested with master binary and functional test fails.
322 | + if (!m_args.at(n - 1).IsOptional()) { 323 | + num_required_args = n; 324 | + break; 325 | + } 326 | + } 327 | + return num_required_args <= num_args && num_args <= m_args.size();
nit, could early return with if (num_args > m_args.size()) return false;.
I think this is the wrong place to overoptimize
314 | @@ -315,6 +315,17 @@ std::string RPCExamples::ToDescriptionString() const 315 | return m_examples.empty() ? m_examples : "\nExamples:\n" + m_examples; 316 | } 317 | 318 | +bool RPCHelpMan::IsValidNumArgs(size_t num_args) const 319 | +{ 320 | + size_t num_required_args = 0; 321 | + for (size_t n = m_args.size(); n > 0; --n) {
nit, could change condition to n > num_args?
No, that would be incorrect
Tested ACK fa4ce7038d444defe0b98a30097174c278054a33.
Could update license year in test/functional/rpc_getblockstats.py.
Could update license year in test/functional/rpc_getblockstats.py.
Please, let's not start nitting about copyright years. In as far as they matter at all (we don't know!) updating these once per year is enough.
utACK fa4ce7038d444defe0b98a30097174c278054a33