Skip to content

Commit 0a75528

Browse files
interfaces: expose network reachability to the GUI
Node::isReachable(Network) answers whether outbound connections to a network are allowed, from g_reachable_nets: the effect of -onlynet, -onion, -noonion and the onion proxy the Tor controller configures once it has connected. The DashPay GUI needs it to choose how it connects to evonodes the way Core connects to its peers, and reading -onlynet itself would miss everything but -onlynet. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent e614688 commit 0a75528

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎src/interfaces/node.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,10 @@ class Node
413413
//! Get proxy.
414414
virtual bool getProxy(Network net, Proxy& proxy_info) = 0;
415415

416+
//! Whether outbound connections to this network are allowed (-onlynet,
417+
//! -onion, -noonion and the onion proxy the Tor controller configures).
418+
virtual bool isReachable(Network net) = 0;
419+
416420
//! Get number of connections.
417421
virtual size_t getNodeCount(ConnectionDirection flags) = 0;
418422

‎src/node/interfaces.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,7 @@ class NodeImpl : public Node
957957
}
958958
void mapPort(bool use_upnp, bool use_natpmp) override { StartMapPort(use_upnp, use_natpmp); }
959959
bool getProxy(Network net, Proxy& proxy_info) override { return GetProxy(net, proxy_info); }
960+
bool isReachable(Network net) override { return g_reachable_nets.Contains(net); }
960961
size_t getNodeCount(ConnectionDirection flags) override
961962
{
962963
return m_context->connman ? m_context->connman->GetNodeCount(flags) : 0;

0 commit comments

Comments
 (0)