diff options
author | Lucas Ontivero <lucasontivero@gmail.com> | 2020-12-10 14:26:58 -0300 |
---|---|---|
committer | Lucas Ontivero <lucasontivero@gmail.com> | 2020-12-14 14:48:52 -0300 |
commit | f7264fff0a098f8b6354c7373b8790791c25dd07 (patch) | |
tree | 5bf633a063956d53354a827d526d0267f4f9f549 /src/test/net_tests.cpp | |
parent | b76abae387b9ac2526c315c95b0f2da8c78e16fc (diff) |
Check if Cjdns address is valid
Diffstat (limited to 'src/test/net_tests.cpp')
-rw-r--r-- | src/test/net_tests.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp index cec4a8df61..c86974ba5b 100644 --- a/src/test/net_tests.cpp +++ b/src/test/net_tests.cpp @@ -604,6 +604,16 @@ BOOST_AUTO_TEST_CASE(cnetaddr_unserialize_v2) BOOST_CHECK_EQUAL(addr.ToString(), "fc00:1:2:3:4:5:6:7"); BOOST_REQUIRE(s.empty()); + // Invalid CJDNS, wrong prefix. + s << MakeSpan(ParseHex("06" // network type (CJDNS) + "10" // address length + "aa000001000200030004000500060007" // address + )); + s >> addr; + BOOST_CHECK(addr.IsCJDNS()); + BOOST_CHECK(!addr.IsValid()); + BOOST_REQUIRE(s.empty()); + // Invalid CJDNS, with bogus length. s << MakeSpan(ParseHex("06" // network type (CJDNS) "01" // address length |