-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
cli: rework -addrinfo cli to use addresses which aren’t filtered for quality/recency #26988
base: master
Are you sure you want to change the base?
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
cac08f2
to
caab213
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK, will review soon.
caab213
to
c645fb6
Compare
obvious concept ack considering I proposed #26907 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, only minor nits.
ping @jonatack, could you have a look, especially at the changes to bitcoin-cli?
c645fb6
to
35bd55c
Compare
35bd55c
to
a04bfa3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
"network" : "str", (string) The network (ipv4, ipv6, onion, i2p, cjdns) Instead of being a string, wouldn't make sense it to be an array? E.g. I want to get new/tried table address count for ipv4 and ipv6 together. |
a04bfa3
to
7c34c35
Compare
i'm confused about this since making it into and there are only few network types. would be interested in what others think. |
to minimize the complexity that we need to maintain over time, we try to reduce the amount of client-side niftiness that we offer. it seems to me that the string would offer all the information needed for a client to write a simple query if they wanted the sum of multiple. agreed that the syntax is another challenge of the array type so I am +1 to leaving as is |
that was just a question, thinking about complexity I agree on leaving it as is. going to review in depth soon. |
light code review ACK 7c34c35. tested that the RPC and cli endpoints make sense & handle errors reasonably. these changes will require release notes, which can be done here or in a separate PR. |
I think it makes sense to unhide this RPC; we have plenty of |
c70d1c9
to
0b4ccbd
Compare
Rebased.
That sounds reasonable. Done in #28565. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested ACK 0b4ccbd
output before this PR
/src/bitcoin-cli -signet -addrinfo
{
"addresses_known": {
"ipv4": 1097,
"ipv6": 352,
"onion": 0,
"i2p": 0,
"cjdns": 0,
"total": 1449
}
}
output after this PR
./src/bitcoin-cli -signet -addrinfo
{
"addresses_known": {
"ipv4": 2157,
"ipv6": 834,
"onion": 0,
"i2p": 0,
"cjdns": 0,
"all_networks": 2991,
"total": 5982
}
}
I share the same concerns as @jonatack regarding maintaining backward compatibility.
Also, regarding both the totals and per network differences between before and after this changes I wonder if we should add some context in the output or in the help for the user to understand where those differences are coming from. (Mainly due to @jonatack's comment here and @mzumsande's comment here regarding isTerrible()
).
Last thing for now, @stratospher I see you agreed with @brunoerg's suggestion but I don't see the changes, perhaps it was removed and I missed some discussion about it.
e6e444c refactor: add and use EnsureAnyAddrman in rpc (stratospher) bf589a5 doc: add release notes for #27511 (stratospher) 3931e6a rpc: `getaddrmaninfo` followups (stratospher) Pull request description: - make `getaddrmaninfo` RPC public since it's not for development purposes only and regular users might find it useful. [#26988 (comment)](#26988 (comment)) - add missing `all_networks` key to RPC help. [#27511 (comment)](#27511 (comment)) - fix clang format spacing - add and use `EnsureAddrman` in RPC code. [#27511 (comment)](#27511 (comment)) ACKs for top commit: 0xB10C: Code Review re-ACK e6e444c theStack: Code-review ACK e6e444c pablomartin4btc: tested ACK e6e444c Tree-SHA512: c14090d5c64ff15e92d252578de2437bb2ce2e1e431d6698580241a29190f0a3528ae5b013c0ddb76a9ae538507191295c37cab7fd93469941cadbde44587072
2cc8ca1 [test] Use deterministic addrman in addrman info tests (stratospher) a897866 [test] Restart a node with empty addrman (stratospher) 71c1991 [test] Use deterministic addrman in addpeeraddress test (stratospher) 7b868e6 Revert "test: avoid non-determinism in asmap-addrman test" (stratospher) 69e091f [init] Create deterministic addrman in tests using -test=addrman (stratospher) be25ac3 [init] Remove -addrmantest command line arg (stratospher) 802e6e1 [init] Add new command line arg for use only in functional tests (stratospher) Pull request description: An address is placed in a `[bucket,position]` in the addrman table (new table or tried table) using the `addpeeraddress` RPC. This `[bucket,position]` is calculated using `nKey`(and other metrics) for the addrman which is chosen randomly during every run. Supposing there are 2 addresses to be placed in an addrman table. During every test run, a different `[bucket,position]` would be calculated for each address.These calculated `[bucket,position]` could even be the same for the 2 addresses in some test runs and result in collisions in the addrman. We wouldn't be able to predict when the collisions are going to happen because we can't predict the `nKey` value which is chosen at random. This can cause flaky tests. Because of these non deterministic collisions, we are limited in what we can do to test addrman functionality. Currently in our tests don't add a second address to prevent these collisions from happening - we only keep 1 address in the new table and 1 address in the tried table. See #26988 (comment), #23084, [#22831(comment)](https://github.com/bitcoin/bitcoin/pull/22831/files#r708302639). This PR lets us create a deterministic addrman with fixed `nKey` so that we can know the `[bucket,position]` collisions beforehand, safely add more addresses in an addrman table and write more extensive tests. ACKs for top commit: amitiuttarwar: ACK 2cc8ca1 achow101: ACK 2cc8ca1 0xB10C: ACK 2cc8ca1 mzumsande: Code Review ACK 2cc8ca1 Tree-SHA512: 8acd9bdfe7de1eb44d22373bf13533d8ecf602df966fdd5b8b78afcd8cc35a286c95d2712f67a89473a0d68dded7d38f5599f6e4bf95a6589475444545bfb189
What is the state of this @stratospher? Are you still looking for feedback on #26988 (comment)? |
Turned into draft for now, due to outstanding feedback. If this is no longer a WIP, you can move it out of draft. |
0b4ccbd
to
981aa3a
Compare
Thank you for the reviews @pablomartin4btc! I've rebased the PR and included your suggestion.
i prefer not adding niche details in the user output/help because the difference would only be felt temporarily when users upgrade and it is covered in the release notes.
yes! that suggestion isn't applicable anymore since the RPC is public. this was done in #27511. |
@sr-gi, yes! that's the only unresolved conversation. i personally prefer the current approach as explained in #26988 (comment) which simply reports an error in case an older version of bitcoind is used with a newer bitcoin-cli. |
981aa3a
to
aebfac1
Compare
@stratospher Referencing the review feedback in #26988 (comment), the argument about complexity doesn't outweigh that, and less so when there are simple alternatives that have been proposed. If this were to be merged as-is while ignoring the review feedback above, then we'd need to propose fixes for it. I don't think it makes sense to break things only to need to fix them. |
That's not helpful to someone with a long-running older node (say, for benchmarking or statistical purposes, which may also include compiling data from |
Rework of
-addrinfo
CLI is done usinggetaddrmaninfo
RPC proposed in #27511. This would be useful for users who want to know the total number of addresses the node knows about and can make connections to.Currently,
-addrinfo
returns total number of addresses the node knows about after filtering them for quality + recency usingisTerrible
. HoweverisTerrible
addresses don't matter when selecting outbound peers to connect to. Total number of addresses the node knows about could be higher than what-addrinfo
currently displays. See #24370.