Motivation
The Discover() function in init.cpp was only being called if bind_on_any was true. However, bind_on_any is set to false if an explicit -bind argument is provided, even if that argument is -bind=0.0.0.0 (which effectively binds to all interfaces).
This behavior prevented local address discovery when a user explicitly configured -bind=0.0.0.0, which is common in containerized environments or when users want to be explicit about interface binding.
Fixes #31293.
Solution
Updated the logic in init.cpp to check if any of the provided bind addresses (either via -bind or -whitebind) are “any” addresses (0.0.0.0 or ::). If so, we enable discovery.
Testing
- Validated that
Discover()is called when-bind=0.0.0.0is used. - Verified standard behavior (no bind, specific bind) remains unchanged.