-
Notifications
You must be signed in to change notification settings - Fork 37.7k
net: Add CNode::ConnectedThroughNetwork member function #19998
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
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. |
Concept ACK Nice! :) |
9efd992
to
fcd938e
Compare
Concept ACK What about a multiple-choice option that more generally specifies the network that the connection (comes in/goes out) through, instead of specializing it for Tor? Might want to have the same for I2P later, for example. Also this should be 'onion' to be consistent with our other uses. |
Do I understand you correctly that smth following is expected:
? |
Concept ACK. |
This was the goal in #20002, which exposes the |
What about limiting this PR to introducing Or just drop the last commit in favor of #20002 (if |
@hebasto after chatting offline, that makes sense, will look at building on your commit "net: Add CNode::ConnectedViaTor() member function". Concept ACK in any case, will test your inbound onions detection. |
fcd938e
to
911a3f9
Compare
Updated fcd938e -> 911a3f9 (pr19998.02 -> pr19998.03, diff):
@laanwj @naumenkogs RPC part has been moved to #20002 now. |
via_tor
to getpeerinfo
output
Updated c972792 -> ac0f497 (pr19998.07 -> pr19998.08) due to the conflict with #19991. |
Do you plan to add test coverage for the changes here (and in #19991?) |
I thought your tests could cover all aspects, right? |
@hebasto I don't plan to open a PR just for follow-up tests. I think it's easiest when the coverage accompanies the changes. |
Starting to see inbound onions while testing this on #20002 (Edit: WIP update now pushed if anyone wants to use it for testing).
The updated function here is easy to use, too. stats.m_network = GetNetworkName(ConnectedThroughNetwork()); |
Added test coverage. |
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.
ACK, I've been testing this with #20002 and also rebased on #19954 (it's thankfully a clean merge) and it seems to be working. A few optional comments below. It may be good to update fuzz/netaddress.cpp
(or other fuzzers, I didn't look further) with ConnectedThroughNetwork()
and add unit or functional tests for the new -bind
functionality. I did add some testing in #20002 for the values returned by ConnectedThroughNetwork()
. Edit: reviewing the new push!
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.
ACK. The new unit tests are green for me locally. Not sure what's up with the travis linter.
Updated 5fc8f15 -> 3989fcf (pr19998.10 -> pr19998.11):
|
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.
ACK 3989fcf
Updated 3989fcf -> 3984b78 (pr19998.11 -> pr19998.12, diff): |
Code review ACK 3984b78 |
…unction 3984b78 test: Add tests for CNode::ConnectedThroughNetwork (Hennadii Stepanov) 49fba9c net: Add CNode::ConnectedThroughNetwork member function (Hennadii Stepanov) d4dde24 net: Add CNode::m_inbound_onion data member (Hennadii Stepanov) Pull request description: This PR: - adds `CNode::ConnectedThroughNetwork` member function - is based on bitcoin#19991, and only last two commits belong to it - is required for bitcoin-core/gui#86 and bitcoin#20002 ACKs for top commit: jonatack: re-ACK 3984b78 per `git diff 3989fcf 3984b78` laanwj: Code review ACK 3984b78 Tree-SHA512: 23a9c8bca8dca75113b5505fe443b294f2d42d03c98c7e34919da12d8396beb8d0ada3a58ae16e3da04b7044395f72cf9c216625afc078256cd6c897ac42bf3d
…lify/improve -netinfo 6272604 refactor: enable -netinfo to add future networks (i2p, cjdns) (Jon Atack) 82fd402 refactor: promote some -netinfo localvars to class members (Jon Atack) 5133fab cli: simplify -netinfo using getpeerinfo network field (Jon Atack) 4938a10 rpc, test: expose CNodeStats network in RPC getpeerinfo (Jon Atack) 6df7882 net: add peer network to CNodeStats (Jon Atack) Pull request description: This PR: - builds on #19991 and #19998 - exposes peer networks via a new getpeerinfo `network` field ("ipv4", "ipv6", or "onion"), and adds functional tests - updates -netinfo to use getpeerinfo `network` rather than detecting the peer networks client-side - refactors -netinfo to easily add future networks ACKs for top commit: laanwj: ACK 6272604 Tree-SHA512: 28883487585135ceaaf84ce09131f2336e3193407f2e3df0960e3f4ac340f500ab94ffecb9d06a4c49bc05e3cca4f914ea4379860bea0bd5df2f834f74616015
…o; simplify/improve -netinfo 6272604 refactor: enable -netinfo to add future networks (i2p, cjdns) (Jon Atack) 82fd402 refactor: promote some -netinfo localvars to class members (Jon Atack) 5133fab cli: simplify -netinfo using getpeerinfo network field (Jon Atack) 4938a10 rpc, test: expose CNodeStats network in RPC getpeerinfo (Jon Atack) 6df7882 net: add peer network to CNodeStats (Jon Atack) Pull request description: This PR: - builds on bitcoin#19991 and bitcoin#19998 - exposes peer networks via a new getpeerinfo `network` field ("ipv4", "ipv6", or "onion"), and adds functional tests - updates -netinfo to use getpeerinfo `network` rather than detecting the peer networks client-side - refactors -netinfo to easily add future networks ACKs for top commit: laanwj: ACK 6272604 Tree-SHA512: 28883487585135ceaaf84ce09131f2336e3193407f2e3df0960e3f4ac340f500ab94ffecb9d06a4c49bc05e3cca4f914ea4379860bea0bd5df2f834f74616015
Summary: This is a backport of [[bitcoin/bitcoin#19998 | core#19998]] [1/3] bitcoin/bitcoin@d4dde24 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D10456
Summary: This is a backport of [[bitcoin/bitcoin#19998 | core#19998]] [2/3] bitcoin/bitcoin@49fba9c Depends on D10456 Test Plan: `ninja all check-all` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D10457
Summary: Note: I didn't backport the inline comments for argument names, because I don't think it is an improvement (my IDE already show the parameter names for literal parameters) and it will not help avoiding future merge conflicts (coding style incompatible with our linter and different signature for the `CNode` constructor) This is a backport of [[bitcoin/bitcoin#19998 | core#19998]] [3/3] bitcoin/bitcoin@3984b78 Depends on D10457 Test Plan: `ninja check` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Subscribers: majcosta Differential Revision: https://reviews.bitcoinabc.org/D10458
This PR:
CNode::ConnectedThroughNetwork
member function