net: Fix Discover() not running when using -bind=0.0.0.0:port#32757
net: Fix Discover() not running when using -bind=0.0.0.0:port#32757b-l-u-e wants to merge 3 commits intobitcoin:masterfrom
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32757. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste 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. |
5d5bf98 to
b17208d
Compare
|
Concept ACK Removing duplicate code from |
b17208d to
776b7ee
Compare
yuvicc
left a comment
There was a problem hiding this comment.
lgtm ACK 776b7ee5855f7572798eff3014030bcc53aa7393
776b7ee to
99f8a6b
Compare
|
vasild about the In your patch, node 2 only has ['-discover', f'-whitebind=0.0.0.0:{self.bind_ports[2]}'], # Explicit -whitebind=0.0.0.0But, when I tried this configuration, I encountered port conflicts because the test framework automatically adds an onion bind to node 2, which conflicts with the port already used by node 1. Test Results: Without dummy onion bind (your suggested configuration): With dummy onion bind current implementation: The issue is that when using only So, I added a dummy onion bind: ['-discover', f'-whitebind=0.0.0.0:{self.bind_ports[2]}', f'-bind=127.0.0.1:{self.bind_ports[2]+100}=onion']This ensures the test runs while still testing the intended |
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
4fdc0b1 to
ad3f60b
Compare
pinheadmz
left a comment
There was a problem hiding this comment.
ACK ad3f60b0ea59dbbe7aedcfdcca1caddefffe6976
Built and tested on macos/arm64 and debian/x86. Reviewed code changes which are minimal, this PR searches bind settings for 0.0.0.0 specifically to call Discover() which attempts to add local addresses for peer advertising. Also adds test coverage using 1.1.1.1 and 2.2.2.2 which I was able to set up and check locally on both platforms. Also tested on main.
I would really like to know if its possible to run this test in CI as vasild suggested here and if so, should probably be added to this PR
Show Signature
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
ACK ad3f60b0ea59dbbe7aedcfdcca1caddefffe6976
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEE5hdzzW4BBA4vG9eM5+KYS2KJyToFAmh2awsACgkQ5+KYS2KJ
yTouuhAAmT1tLlOOKdhryZE9K+44Bcsn6prMoLono71Dzf+U+hkQpfxaCcwlI17c
hIW51zz/KZWTudgkDLSWU1RMhCDxMk8XFRdh47TD13OhOVrFJF3Al/uCrMFTXOB5
mPX2c7v6xOvx6DRlqZlCNDKKTOV1gPIM3+vyScmPA68Vh4ibxwzfYK9Lr0ss92fA
ceyCZttPOV6v57dazDn2Lm3siGWfS0+urnwf02TIlShklfW6+juz9AWfa8cmHw8E
GjO0D/r6BNW0TSeHSgt8jpxkVuGxl6opVkn+295hkZ4m9PM44eq7C1avK3yL9exl
LlsGdk9e/vsesJZne+hnppux1xivbfRbze0Z2J3fOpSdckU8mL8TpJlnyoRbQXAo
l3Cawmarwjm7sSQBRZsnAHNw6dN8qQ3ICkCPvK86UG8GLXhG76hcQBZY/NmwMqg7
hl8Np64L3bpH8dHU1Q/9gxHy6h3lPw9GNiOZFaQVvGQZicTzY7WxjhHcAevEHDvu
h9JxUBUPyroHxQkX2vDVBiyLM5pz8FtUOb7MWj5K0bFE1fg6IuY8XZog4BC/zWUL
eTLX330l883y2WoUrILAyrSe1B0HSt0SEh5yOqdwaBAuJ3lcvpht50D+0Z3wPvXU
FShlGSxgvUHBAaDSf/7aG3d48uYkoSKKnek5i65RZIG1oViucUE=
=snJ5
-----END PGP SIGNATURE-----
pinheadmz's public key is on openpgp.org
ad3f60b to
894fc0c
Compare
pinheadmz
left a comment
There was a problem hiding this comment.
Thanks for fixing the nit in the test.
In general, nit-fixes should be squashed (not added as an extra commit) so the final commit history is clean and perfect ;-)
Also I think you rebased on master which is ok, but it makes review slightly harder because my local copy of your branch is now dozens of commits different from the current state of the PR. I used git range-diff to isolate the changes which is why its not like, a super hard rule, but again in general, try not to rebase on master unless you have to (to fix a conflict, include other merged commits, etc)
57588f7 to
a9b7542
Compare
vasild
left a comment
There was a problem hiding this comment.
Almost ACK a9b7542b6ea1af770d93cbbf5bb55dae6841334f
I encountered port conflicts because the test framework automatically adds an onion bind to node 2,
Hmm, I think it is not the test framework but bitcoind itself that adds the onion bind. To figure out how bitcoind is started, e.g. for nodes[2] I look at /tmp/bitcoin_func_test_.../node2/regtest/debug.log for the lines like:
...
Config file arg: [regtest] shrinkdebugfile="0"
Config file arg: [regtest] unsafesqlitesync="1"
Command-line arg: bind="127.0.0.1:23642=onion"
Command-line arg: datadir="/tmp/bitcoin_func_test_h7qvveos/node2"
...
which conflicts with the port already used by node 1
Are you sure it is nodes[1] and nodes[2] conflicting? What is the error message? What is the output of ./test/functional/combine_logs.py |grep 'Bound to'? I got nodes[2] to bind the whitebind and tor on the same port, see my comment below.
Yes am still working on this |
210dd40 to
e0463f3
Compare
8c5f2b4 to
37855ae
Compare
37855ae to
69b54df
Compare
Signed-off-by: b-l-u-e <[email protected]>
Signed-off-by: b-l-u-e <[email protected]>
Signed-off-by: b-l-u-e <[email protected]>
69b54df to
bb00fd2
Compare
|
tested ACK bb00fd2 Reviewed code changes and tested on macos/arm64 the I tested that this builds and the test passes I did not manually test this in regtest for example. The test is simple to understand and passes which gives me enough confidence without more testing. This closes #31293 and prepares for #33362 Question: would it make sense to also test IPv6 |
|
This has six stale ACKs. Could previous reviewers take another look here? |
This PR fixes two related issues with address discovery when using explicit bind addresses in Bitcoin Core:
feature_bind_port_discover.pyis failing #31336When using
-bind=0.0.0.0:port(or-bind=::), theDiscover()function was not being executed because the code only checked thebind_on_anyflag. This led to two problems:feature_bind_port_discover.pywould fail, as it expects local addresses to be discovered in these cases.This PR:
bind_on_anyand any bind addresses usingIsBindAny()Ensures
Discover()runs when binding to 0.0.0.0 or ::, even if specified explicitly.The node will now discover its own addresses when using explicit "any" binds, matching user expectations and fixing the test.
The semantic meaning of
bind_on_anyis preserved as defined innet.h:The functional test
feature_bind_port_discover.pyis updated to use dynamic ports instead of hardcoded ones, improving reliability.References
Closes #31293
The #31336 has the overall test failure and requires both this PR and #33362 to be fully resolved.