Skip to content

Commit 78f456c

Browse files
committed
net: recognize CJDNS from ParseNetwork()
This allows to use "cjdns" as an argument to the `getnodeaddresses` RPC and to the `-onlynet=` parameter.
1 parent de01e31 commit 78f456c

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/netbase.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ enum Network ParseNetwork(const std::string& net_in) {
9696
if (net == "i2p") {
9797
return NET_I2P;
9898
}
99+
if (net == "cjdns") {
100+
return NET_CJDNS;
101+
}
99102
return NET_UNROUTABLE;
100103
}
101104

src/test/netbase_tests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,13 @@ BOOST_AUTO_TEST_CASE(netbase_parsenetwork)
339339
BOOST_CHECK_EQUAL(ParseNetwork("ipv6"), NET_IPV6);
340340
BOOST_CHECK_EQUAL(ParseNetwork("onion"), NET_ONION);
341341
BOOST_CHECK_EQUAL(ParseNetwork("tor"), NET_ONION);
342+
BOOST_CHECK_EQUAL(ParseNetwork("cjdns"), NET_CJDNS);
342343

343344
BOOST_CHECK_EQUAL(ParseNetwork("IPv4"), NET_IPV4);
344345
BOOST_CHECK_EQUAL(ParseNetwork("IPv6"), NET_IPV6);
345346
BOOST_CHECK_EQUAL(ParseNetwork("ONION"), NET_ONION);
346347
BOOST_CHECK_EQUAL(ParseNetwork("TOR"), NET_ONION);
348+
BOOST_CHECK_EQUAL(ParseNetwork("CJDNS"), NET_CJDNS);
347349

348350
BOOST_CHECK_EQUAL(ParseNetwork(":)"), NET_UNROUTABLE);
349351
BOOST_CHECK_EQUAL(ParseNetwork("tÖr"), NET_UNROUTABLE);

test/functional/rpc_net.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ def test_getnodeaddresses(self):
228228
assert_equal(res[0]["port"], 8333)
229229
assert_equal(res[0]["services"], P2P_SERVICES)
230230

231-
# Test for the absence of onion and I2P addresses.
232-
for network in ["onion", "i2p"]:
231+
# Test for the absence of onion, I2P and CJDNS addresses.
232+
for network in ["onion", "i2p", "cjdns"]:
233233
assert_equal(self.nodes[0].getnodeaddresses(0, network), [])
234234

235235
# Test invalid arguments.

0 commit comments

Comments
 (0)