doc: update helps for addnode rpc and -addnode/-maxconnections config options #21710

pull jonatack wants to merge 3 commits into bitcoin:master from jonatack:update-addnode-docs changing 2 files +5 −3
  1. jonatack commented at 7:09 pm on April 16, 2021: member

    Since #9319 proposed by Gregory Maxwell and released in v0.14, peers manually added through the -addnode config option or using the addnode RPC have their own separate limit of 8 connections that does not compete with other inbound or outbound connection usage and is not subject to the limitation imposed by the -maxconnections option.

    This PR updates the -addnode and -maxconnections config options and the addnode RPC help docs with this information.

    -addnode config option help

     0$ bitcoind -h | grep -A5 addnode=
     1  -addnode=<ip>
     2       Add a node to connect to and attempt to keep the connection open (see
     3       the addnode RPC help for more info). This option can be specified
     4       multiple times to add multiple nodes; connections are limited to
     5       8 at a time and are counted separately from the -maxconnections
     6       limit.
     7
     8$ bitcoind -h | grep -A3 maxconnections=
     9  -maxconnections=<n>
    10       Maintain at most <n> connections to peers (default: 125). This limit
    11       does not apply to connections manually added via -addnode or the
    12       addnode RPC, which have a separate limit of 8.
    

    addnode rpc help

    0$ bitcoin-cli help addnode
    1addnode "node" "command"
    2
    3Attempts to add or remove a node from the addnode list.
    4Or try a connection to a node once.
    5Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be
    6full nodes/support SegWit as other outbound peers are (though such peers will not be synced from).
    7Addnode connections are limited to 8 at a time and are counted separately from the -maxconnections limit.
    
  2. doc: update addnode rpc help 2896c6c4cc
  3. doc: update -addnode config option help 79685a8992
  4. DrahtBot added the label RPC/REST/ZMQ on Apr 16, 2021
  5. ghost commented at 10:18 pm on April 16, 2021: none

    Interesting. I didn’t know -addnode had any separate limits. Concept ACK.

    Will have to test today and maybe ask related questions here or SE or Reddit.

  6. jonatack commented at 9:16 am on April 17, 2021: member

    Interesting. I didn’t know -addnode had any limits. Concept ACK.

    Thanks @prayank23. Indeed, as it’s not documented AFAIK except in the 0.14 release notes a few years back, I imagine that many users won’t ever know unless they look into the codebase, e.g. in net.h

    0static const int MAX_ADDNODE_CONNECTIONS = 8;
    

    and then verifying how the constant is used, or they infer it by using -netinfo with more than 8 addnode peers configured and seeing that the number of manual connections never exceeds 8 (or by using getpeerinfo with jq).

  7. doc: update -maxconnections config option help b4fcbcfb49
  8. jonatack renamed this:
    doc: update help docs for -addnode config option and addnode rpc
    doc: update helps for addnode rpc and -addnode/-maxconnections config options
    on Apr 17, 2021
  9. ghost commented at 4:55 pm on April 17, 2021: none

    I imagine that many users won’t ever know unless they look into the codebase, e.g. in net.h

    Maybe I missed it when I was experimenting with outgoing connections few days back: https://bitcoin.stackexchange.com/questions/103753/increase-maximum-number-of-outgoing-connections-for-full-node

    I should have tried addnode to get more outgoing connections.

    Not sure what’s the best way to test this. I tried adding random nodes from https://bitnodes.io/nodes/?q=United%20States using addnode RPC in Bitcoin Core (Mainnet). Looking at the total number of outgoing connections: 13 which is more than 10 I can verify addnode has separate limits that do not compete with other inbound or outbound connection usage.

    Added maxconnections=4 in bitcoin.conf, relaunched Bitcoin Core, tried adding random nodes from above link and it worked as expected (I could see more than 4 peers connected) and mentioned in https://github.com/bitcoin/bitcoin/pull/21710/commits/b4fcbcfb49461b96bc72fb64d6152de7c5ce00de

  10. jonatack commented at 6:30 pm on April 17, 2021: member

    @prayank23 thanks for having a look. If you run a node with more than 8 -addnode peers (you can get a list of, say, 20 peers from your addrman if needed with bitcoin-cli getnodeaddresses 20), you’ll never see more than 8 connections in the “manual” column of cli -netinfo:

    0        ipv4    ipv6   onion     i2p   total   block  manual
    1in         0       0       1       0       1
    2out        4       0      10       4      18       2       8
    3total      4       0      11       4      19
    

    Codewise, I suggest looking at the code returned by git grep nMaxAddnode – there are only six lines.

  11. jarolrod commented at 1:47 am on April 18, 2021: member

    ACK b4fcbcfb49461b96bc72fb64d6152de7c5ce00de

    Looks good to me. Documenting in the help that addnode connections are counted separately from maxconnections is useful context to add.

  12. jonatack commented at 1:41 pm on April 18, 2021: member

    Thanks @jarolrod!

    If anyone is curious, the separate connections limit for addnode peers was added by @gmaxwell in #9319. I’ve added the PR link to the PR description.

  13. jonatack commented at 3:39 pm on April 18, 2021: member

    I was experimenting with outgoing connections few days back: https://bitcoin.stackexchange.com/questions/103753/increase-maximum-number-of-outgoing-connections-for-full-node

    I should have tried addnode to get more outgoing connections.

    FWIW, I found #6014 to be an interesting discussion about connection counts.

  14. ghost commented at 8:08 pm on April 18, 2021: none

    ACK https://github.com/bitcoin/bitcoin/commit/b4fcbcfb49461b96bc72fb64d6152de7c5ce00de

    FWIW, I found #6014 to be an interesting discussion about connection counts.

    Thanks for sharing the link. I have 3 follow up questions after reading few things in that PR:

    1. If more than 8 outgoing connections are bad for the network, can we at least have one option in bitcoin.conf to reduce this to something below 8 if the user wants to? Maybe keep Default=8, MIN=2, MAX=8 and OUTBOUND_FULL_RELAY_CONNECTIONS can be anything between 2 and 8.
    2. If the user can add more outgoing connections using addnode which has a separate limit so total number of full relay outgoing connections can be more than 8, is this okay and does not the involve the risks mentioned in #6014 ?
    3. How did we decide this number 8? Why is it not 7 or 9?
  15. jonatack commented at 8:25 pm on April 18, 2021: member

    If more than 8 outgoing connections are bad for the network, can we at least have one option in bitcoin.conf to reduce this to something below 8 if the user wants to?

    See #4687.

  16. DrahtBot commented at 12:21 pm on April 30, 2021: member

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

    Conflicts

    No conflicts as of last run.

  17. laanwj merged this on May 5, 2021
  18. laanwj closed this on May 5, 2021

  19. jonatack deleted the branch on May 5, 2021
  20. sidhujag referenced this in commit a48c44fabd on May 5, 2021
  21. gwillen referenced this in commit b20d4cbdb5 on Jun 1, 2022
  22. DrahtBot locked this on Aug 16, 2022

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-07-03 10:13 UTC

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