CLI: Only one Request Handler can be specified. #27815

pull Brotcrunsher wants to merge 1 commits into bitcoin:master from Brotcrunsher:cli_request_handlers changing 1 files +8 −0
  1. Brotcrunsher commented at 0:07 am on June 4, 2023: contributor
    Previously it was possible to specify multiple, however only one was picked in this arbitrary and (probably) undocumented priority: getinfo > netinfo > generate > addrinfo.
  2. CLI: Only one Request Handler can be specified. Previously it was possible to specify multiple, however only one was picked in this arbitrary and (probably) undocumented priority: getinfo > netinfo > generate > addrinfo. 244e6c8db8
  3. DrahtBot commented at 0:07 am on June 4, 2023: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK pablomartin4btc

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. DrahtBot added the label Scripts and tools on Jun 4, 2023
  5. in src/bitcoin-cli.cpp:1178 in 244e6c8db8
    1169@@ -1170,6 +1170,14 @@ static int CommandLineRPC(int argc, char *argv[])
    1170                 fputc('\n', stdout);
    1171             }
    1172         }
    1173+        int nRh = 0;
    1174+        if (gArgs.IsArgSet("-getinfo")) nRh++;
    1175+        if (gArgs.GetBoolArg("-netinfo", false)) nRh++;
    1176+        if (gArgs.GetBoolArg("-generate", false)) nRh++;
    1177+        if (gArgs.GetBoolArg("-addrinfo", false)) nRh++;
    1178+        if (nRh > 1) {
    


    luke-jr commented at 1:52 am on June 24, 2023:
    0        if (gArgs.IsArgSet("-getinfo") + gArgs.GetBoolArg("-netinfo", false) + gArgs.GetBoolArg("-generate", false) + gArgs.GetBoolArg("-addrinfo", false) > 1) {
    

    This is admittedly a bit obscure, so maybe there’s a better way (but it’s still an improvement over the temporary variable IMO)

  6. luke-jr changes_requested
  7. luke-jr commented at 0:12 am on July 3, 2023: member
    nit: Commit summary is too long. Would also be nice to rebase on top of 42af9596ce85a541988abee54eed8a9b271a46a1
  8. luke-jr referenced this in commit 468087b183 on Aug 16, 2023
  9. achow101 requested review from sipa on Sep 20, 2023
  10. DrahtBot added the label CI failed on Oct 25, 2023
  11. pablomartin4btc commented at 3:41 pm on October 25, 2023: member

    Concept ACK.

    I agree this validation should be put in place, please check #26990 if you haven’t already, in the second commit 11e0a80b19a98b79adaa25a06f14d564da3ba85b there’s a function that already does this (IsExclusivelyCliCommand()), feel free to take anything you find useful.

    As pointed out by @luke-jr please check the project guidelines regarding commits specifications.

    Also, for future reference, check the guidelines regarding C++ coding style and naming conventions (e.g. nRh in your code change).

    Thanks for working on this!

  12. maflcko commented at 3:47 pm on October 25, 2023: member
    Are you still working on this?
  13. maflcko added the label Up for grabs on Nov 16, 2023
  14. maflcko closed this on Nov 16, 2023

  15. maflcko removed the label CI failed on Nov 16, 2023
  16. fanquake removed the label Up for grabs on May 21, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-21 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me