Skip to content

Conversation

jonatack
Copy link
Member

@jonatack jonatack commented Oct 20, 2021

instead of only for networks we have peer connections to.

Users reported the previous behavior caused confusion, as no column was printed when a network was reachable but no peers were connected. Users expected a column to be printed with 0 peers. This commit aligns behavior with that expectation.

In addition, the ipv4, ipv6, and onion columns were always printed whether or not they were reachable. With this change, only the reachable ones will be returned.

Example with CJDNS reachable but no CJDNS peers (built on #23077 and #23175):

before

        ipv4    ipv6   onion     i2p   total   block  manual
in         0       0      12       5      17
out        8       1       6       4      19       2       8
total      8       1      18       9      36

after

         ipv4    ipv6   onion     i2p   cjdns   total   block  manual
in          0       0      12       5       0      17
out         8       1       6       4       0      19       2       8
total       8       1      18       9       0      36

There is one additional space between the in/out/total row headers and the network counts.

instead of only for networks we have peer connections to.

Users reported the previous behavior caused confusion,
as no column was printed when a network was reachable
but no peers were connected. Users expected a column
to be printed with 0 peers. This commit aligns
behavior with that expectation.
@laanwj
Copy link
Member

laanwj commented Oct 20, 2021

Concept ACK

@dunxen
Copy link
Contributor

dunxen commented Oct 20, 2021

Concept ACK

Thanks for this! I think this behaviour makes it much clearer and more consistent for all networks.

@practicalswift
Copy link
Contributor

practicalswift commented Oct 20, 2021

Concept ACK

Nice work! Could include before/after examples in the OP to make it even nicer? :)

@jonatack
Copy link
Member Author

Nice work! Could include before/after examples in the OP to make it even nicer? :)

Added!

@jsarenik
Copy link

jsarenik commented Oct 20, 2021

Tested ACK 96f469f

$ ./bitcoin-cli -netinfo                                                       
Bitcoin Core client v22.99.0-96f469f91bc0 - server 70016/Satoshi:22.99.0/

         ipv4   onion     i2p   total   block
in          0       0       0       0
out         9       0       0       9       2
total       9       0       0       9

Local addresses
c35gtgyf5y44mh3tpzxlx4lfqaus2worc6pkmv72soqebxsncytuy6id.onion     port   8333    score      4
qvzki6iqjpgme4v3h3dno5jvytjj56zizokkvgjytkr3shgnlbxa.b32.i2p       port      0    score      4

Thank you @jonatack !

@ghost
Copy link

ghost commented Oct 20, 2021

utACK 96f469f

I had similar confusion when reviewing an i2p PR: #22250 (comment)

@laanwj
Copy link
Member

laanwj commented Oct 20, 2021

Code review and lightly tested ACK 96f469f

@hebasto
Copy link
Member

hebasto commented Oct 20, 2021

Concept ACK.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 96f469f, tested by comparing the output of watch src/bitcoin-cli -netinfo with the Peer tab of the Node window in the GUI 🐅

Also verified with -noonion command-line option:

$ src/bitcoin-cli -netinfo
Bitcoin Core client v22.99.0-96f469f91bc0 - server 70016/Satoshi:22.99.0/

         ipv4    ipv6   total   block
in          0       0       0
out         6       0       6       2
total       6       0       6

Local addresses: n/a

UPDATE: with -onlynet=ipv4 command-line option:

$ src/bitcoin-cli -netinfo
Bitcoin Core client v22.99.0-96f469f91bc0 - server 70016/Satoshi:22.99.0/

         ipv4   onion   total   block  manual
in          0       0       0
out         2       1       3       2       1
total       2       1       3

Local addresses
d6jwdcoo2l3gbjps6asgg4nhp2gn5oao3wj333o43ssqnjaliehytfad.onion     port   8333    score      4

@ghost
Copy link

ghost commented Oct 21, 2021

UPDATE: with -onlynet=ipv4 command-line option:

@hebasto

Did you see zero for 'onion' after few minutes or had 1 onion outgoing connection for a long time with onlynet=ipv4?

I think this won't happen after #22834 gets merged.

@DrahtBot
Copy link
Contributor

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #23175 (Add CJDNS network to -addrinfo and -netinfo by jonatack)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@hebasto
Copy link
Member

hebasto commented Oct 21, 2021

@prayank23

UPDATE: with -onlynet=ipv4 command-line option:

@hebasto

Did you see zero for 'onion' after few minutes or had 1 onion outgoing connection for a long time with onlynet=ipv4?

I think this won't happen after #22834 gets merged.

This onion connection is addnoded.

@naumenkogs
Copy link
Member

ACK 96f469f.
This change is good for understanding node connectivity.

@laanwj laanwj merged commit ee1294f into bitcoin:master Oct 21, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Oct 21, 2021
…-netinfo

96f469f netinfo: print peer counts for all reachable networks (Jon Atack)

Pull request description:

  instead of only for networks we have peer connections to.

  Users reported the previous behavior caused confusion, as no column was printed when a network was reachable but no peers were connected. Users expected a column to be printed with 0 peers. This commit aligns behavior with that expectation.

  In addition, the ipv4, ipv6, and onion columns were always printed whether or not they were reachable. With this change, only the reachable ones will be returned.

  Example with CJDNS reachable but no CJDNS peers (built on bitcoin#23077 and bitcoin#23175):

  before
  ```
          ipv4    ipv6   onion     i2p   total   block  manual
  in         0       0      12       5      17
  out        8       1       6       4      19       2       8
  total      8       1      18       9      36
  ```
  after
  ```
           ipv4    ipv6   onion     i2p   cjdns   total   block  manual
  in          0       0      12       5       0      17
  out         8       1       6       4       0      19       2       8
  total       8       1      18       9       0      36
  ```

  There is one additional space between the in/out/total row headers and the network counts.

ACKs for top commit:
  jsarenik:
    Tested ACK 96f469f
  prayank23:
    utACK bitcoin@96f469f
  laanwj:
    Code review and lightly tested ACK 96f469f
  naumenkogs:
    ACK 96f469f.
  hebasto:
    ACK 96f469f, tested by comparing the output of `watch src/bitcoin-cli -netinfo` with the Peer tab of the Node window in the GUI 🐅

Tree-SHA512: 3489f40148a2bd0afc9eef1e1577d44150c1fccec8dbf2a675bc23aa9343bfcae6c4039f5b96e54730668c83f40bc932fb6808f5540e86ff7249fde8dc0fff67
@jonatack jonatack deleted the netinfo-print-peer-counts-for-all-reachable-networks branch October 21, 2021 16:28
laanwj added a commit that referenced this pull request Nov 15, 2021
7b65287 cli: hoist networks class data members to a constant (Jon Atack)
5bd40a3 cli: add cjdns network to -addrinfo and -netinfo (Jon Atack)

Pull request description:

  Follow-up to #23077 and #23324.
  ```
  $ ./src/bitcoin-cli -addrinfo
  {
    "addresses_known": {
      "ipv4": 47782,
      "ipv6": 10307,
      "onion": 8030,
      "i2p": 41,
      "cjdns": 1,
      "total": 66161
    }
  }
  $ ./src/bitcoin-cli -netinfo
  Bitcoin Core client v22.99.0-deb6223d4c55 - server 70016/Satoshi:22.99.0(jon)/

          ipv4    ipv6   onion     i2p   cjdns   total   block  manual
  in         0       5      12       5       1      23
  out        2       2       9       5       2      20       2      10
  total      2       7      21      10       3      43
  ```
  ```
  $ ./src/bitcoin-cli -netinfo 1
  ```

  ![Screenshot from 2021-10-10 12-01-58](https://user-images.githubusercontent.com/2415484/136691258-8b3fa7aa-3edb-4428-854a-adadfef302e3.png)

ACKs for top commit:
  laanwj:
    Code review ACK 7b65287

Tree-SHA512: 9c740d394d9842d38a1c01a824271b25277baac11ed090f0430daa15b580c2bf3d114ac6b8254b19d6aaee57cbe1ca6a414996e6994e0bf4a577bed771382eca
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Nov 16, 2021
7b65287 cli: hoist networks class data members to a constant (Jon Atack)
5bd40a3 cli: add cjdns network to -addrinfo and -netinfo (Jon Atack)

Pull request description:

  Follow-up to bitcoin#23077 and bitcoin#23324.
  ```
  $ ./src/bitcoin-cli -addrinfo
  {
    "addresses_known": {
      "ipv4": 47782,
      "ipv6": 10307,
      "onion": 8030,
      "i2p": 41,
      "cjdns": 1,
      "total": 66161
    }
  }
  $ ./src/bitcoin-cli -netinfo
  Bitcoin Core client v22.99.0-deb6223d4c55 - server 70016/Satoshi:22.99.0(jon)/

          ipv4    ipv6   onion     i2p   cjdns   total   block  manual
  in         0       5      12       5       1      23
  out        2       2       9       5       2      20       2      10
  total      2       7      21      10       3      43
  ```
  ```
  $ ./src/bitcoin-cli -netinfo 1
  ```

  ![Screenshot from 2021-10-10 12-01-58](https://user-images.githubusercontent.com/2415484/136691258-8b3fa7aa-3edb-4428-854a-adadfef302e3.png)

ACKs for top commit:
  laanwj:
    Code review ACK 7b65287

Tree-SHA512: 9c740d394d9842d38a1c01a824271b25277baac11ed090f0430daa15b580c2bf3d114ac6b8254b19d6aaee57cbe1ca6a414996e6994e0bf4a577bed771382eca
@prusnak prusnak mentioned this pull request Nov 19, 2021
maflcko pushed a commit that referenced this pull request Feb 18, 2022
… and devs

a4da16f Improve -netinfo help based on feedback from users and devs (Jon Atack)

Pull request description:

  Clarify which networks are displayed by the peer counts table (*reachable* networks; follow-up to #23324) in response to questions received over the past months, and a few other improvements.

ACKs for top commit:
  laanwj:
    Code review ACK a4da16f
  w0xlt:
    ACK a4da16f
  kristapsk:
    utACK a4da16f

Tree-SHA512: e6522c08421aa7f10d50723156d0a8fc5ec82cad2f0bd931bbec603077fcd4921c6505ef743d57386fba81c95dcfc77df75abf3378319886368e4ae33f9a6d73
@bitcoin bitcoin locked and limited conversation to collaborators Oct 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants