diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2021-09-22 17:06:31 +0200 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2021-11-03 14:41:14 +0100 |
commit | 78f456c57677e6a3a839426e211078ddf0b3e194 (patch) | |
tree | 2facad8c05428161f9e2c920c47165f533432b24 | |
parent | de01e312b333b65b09c8dc72f0cea6295ab8e43f (diff) |
net: recognize CJDNS from ParseNetwork()
This allows to use "cjdns" as an argument to the `getnodeaddresses` RPC
and to the `-onlynet=` parameter.
-rw-r--r-- | src/netbase.cpp | 3 | ||||
-rw-r--r-- | src/test/netbase_tests.cpp | 2 | ||||
-rwxr-xr-x | test/functional/rpc_net.py | 4 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp index 64d17189a6..56f124579a 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -96,6 +96,9 @@ enum Network ParseNetwork(const std::string& net_in) { if (net == "i2p") { return NET_I2P; } + if (net == "cjdns") { + return NET_CJDNS; + } return NET_UNROUTABLE; } diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp index 687d2f6747..b6d7496cc7 100644 --- a/src/test/netbase_tests.cpp +++ b/src/test/netbase_tests.cpp @@ -339,11 +339,13 @@ BOOST_AUTO_TEST_CASE(netbase_parsenetwork) BOOST_CHECK_EQUAL(ParseNetwork("ipv6"), NET_IPV6); BOOST_CHECK_EQUAL(ParseNetwork("onion"), NET_ONION); BOOST_CHECK_EQUAL(ParseNetwork("tor"), NET_ONION); + BOOST_CHECK_EQUAL(ParseNetwork("cjdns"), NET_CJDNS); BOOST_CHECK_EQUAL(ParseNetwork("IPv4"), NET_IPV4); BOOST_CHECK_EQUAL(ParseNetwork("IPv6"), NET_IPV6); BOOST_CHECK_EQUAL(ParseNetwork("ONION"), NET_ONION); BOOST_CHECK_EQUAL(ParseNetwork("TOR"), NET_ONION); + BOOST_CHECK_EQUAL(ParseNetwork("CJDNS"), NET_CJDNS); BOOST_CHECK_EQUAL(ParseNetwork(":)"), NET_UNROUTABLE); BOOST_CHECK_EQUAL(ParseNetwork("tÖr"), NET_UNROUTABLE); diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py index 0f3bbce54c..103c064cf0 100755 --- a/test/functional/rpc_net.py +++ b/test/functional/rpc_net.py @@ -228,8 +228,8 @@ class NetTest(BitcoinTestFramework): assert_equal(res[0]["port"], 8333) assert_equal(res[0]["services"], P2P_SERVICES) - # Test for the absence of onion and I2P addresses. - for network in ["onion", "i2p"]: + # Test for the absence of onion, I2P and CJDNS addresses. + for network in ["onion", "i2p", "cjdns"]: assert_equal(self.nodes[0].getnodeaddresses(0, network), []) # Test invalid arguments. |