Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix -netinfo backward compat with getpeerinfo pre-v26 #29212

Merged
merged 1 commit into from Jan 11, 2024

Conversation

jonatack
Copy link
Contributor

@jonatack jonatack commented Jan 9, 2024

Commit fb5bfed in #29058 will cause -netinfo to break when calling it on a node that is running pre-v26 bitcoind, as getpeerinfo doesn't yet return a "transport_protocol_type" field.

Fix this by adding an IsNull() check, as already done for other recent getpeerinfo fields, and also in the same commit:

a) avoid checking for the full string "detecting", and instead do the cheaper check for the most frequent case of the string starting with "v"

b) drop displaying the "v" prefix in all the rows, as it doesn't add useful information, and instead use "v" for the column header

c) display nothing when a value isn't determined yet, like for the -netinfo mping and ping columns (as * already has a separate meaning in this dashboard, and ? might look like there is a bug)

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 9, 2024

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
ACK kristapsk, mzumsande, achow101
Concept ACK sipa

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

src/bitcoin-cli.cpp Outdated Show resolved Hide resolved
CLI -netinfo will currently break when calling it on a node that is running
pre-v26 bitcoind, as `getpeerinfo` doesn't yet return a transport_protocol_type
field.

Fix this by adding an `IsNull()` check as already done for other fields, and also:

- avoid checking for the full string "detecting", and instead do the cheaper
  check for the most frequent case of the string starting with "v"

- drop displaying the "v" prefix in all the rows, as it doesn't add useful
  information, and instead use "v" for the column header

- display nothing during peer setup, like for the -netinfo mping and ping columns
@jonatack
Copy link
Contributor Author

jonatack commented Jan 9, 2024

Re-pushed per @kristapsk's feedback (thanks!)

@sipa
Copy link
Member

sipa commented Jan 9, 2024

Concept ACK

Copy link
Contributor

@kristapsk kristapsk left a comment

Choose a reason for hiding this comment

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

ACK 5fa7460

@DrahtBot DrahtBot requested a review from sipa January 9, 2024 21:54
Copy link
Contributor

@mzumsande mzumsande left a comment

Choose a reason for hiding this comment

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

Concept ACK

src/bitcoin-cli.cpp Show resolved Hide resolved
@mzumsande
Copy link
Contributor

Code Review ACK 5fa7460

@achow101
Copy link
Member

ACK 5fa7460

@achow101 achow101 merged commit 4baa162 into bitcoin:master Jan 11, 2024
16 checks passed
@jonatack jonatack deleted the 2024-01-netinfo-transport branch January 11, 2024 19:24
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Mar 14, 2024
CLI -netinfo will currently break when calling it on a node that is running
pre-v26 bitcoind, as `getpeerinfo` doesn't yet return a transport_protocol_type
field.

Fix this by adding an `IsNull()` check as already done for other fields, and also:

- avoid checking for the full string "detecting", and instead do the cheaper
  check for the most frequent case of the string starting with "v"

- drop displaying the "v" prefix in all the rows, as it doesn't add useful
  information, and instead use "v" for the column header

- display nothing during peer setup, like for the -netinfo mping and ping columns

Github-Pull: bitcoin#29212
Rebased-From: 5fa7460
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants