net: add Ensure{any}Banman #27069

pull brunoerg wants to merge 1 commits into bitcoin:master from brunoerg:2023-02-ensureanybanman changing 3 files +26 −17
  1. brunoerg commented at 8:29 pm on February 9, 2023: contributor
    This PR adds Ensure{any}Banman functions to avoid code repetition and make it cleaner. Same approach as done with argsman, chainman, connman and others.
  2. net: add `Ensure{any}Banman`
    it adds `Ensure{any}Banman` functions to avoid
    code repetition and make it cleaner. Similar
    approach as done with argsman, chainman, connman
    and others.
    2d955ff006
  3. DrahtBot commented at 8:29 pm on February 9, 2023: contributor

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK davidgumberg

    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 P2P on Feb 9, 2023
  5. davidgumberg commented at 2:35 am on February 10, 2023: contributor
    ACK 2d955ff
  6. in src/rpc/net.cpp:704 in 2d955ff006
    701@@ -702,9 +702,7 @@ static RPCHelpMan setban()
    702         throw std::runtime_error(help.ToString());
    703     }
    704     NodeContext& node = EnsureAnyNodeContext(request.context);
    


    maflcko commented at 8:20 am on February 10, 2023:
    why not use EnsureAnyBanman here?

    brunoerg commented at 2:07 pm on February 10, 2023:
    Because we need connman to disconnect the node right after banning.

    brunoerg commented at 2:08 pm on February 10, 2023:

    e.g:

    0banman.Ban(subNet, banTime, absolute);
    1if (node.connman) {
    2    node.connman->DisconnectNode(subNet);
    3}
    
  7. maflcko merged this on Feb 10, 2023
  8. maflcko closed this on Feb 10, 2023

  9. sidhujag referenced this in commit 448bcf2fde on Feb 10, 2023
  10. bitcoin locked this on Feb 10, 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: 2026-02-17 06:13 UTC

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