mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
net: recognize CJDNS from ParseNetwork()
This allows to use "cjdns" as an argument to the `getnodeaddresses` RPC and to the `-onlynet=` parameter.
This commit is contained in:
parent
de01e312b3
commit
78f456c576
3 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue