From 272bd3c60c17fbe2444abcb816bc831f1382afe7 Mon Sep 17 00:00:00 2001 From: subtly Date: Mon, 23 Mar 2015 15:26:48 +0100 Subject: gracefully handle old pingnode packet --- net.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'net.cpp') diff --git a/net.cpp b/net.cpp index 23ad0fb4..2ecfafb8 100644 --- a/net.cpp +++ b/net.cpp @@ -145,6 +145,17 @@ public: bool success = false; }; +BOOST_AUTO_TEST_CASE(badPingNodePacket) +{ + // test old versino of pingNode packet w/new + RLPStream s; + s.appendList(3); s << "1.1.1.1" << 30303 << std::chrono::duration_cast((std::chrono::system_clock::now() + chrono::seconds(60)).time_since_epoch()).count(); + + PingNode p((bi::udp::endpoint())); + BOOST_REQUIRE_NO_THROW(p = PingNode::fromBytesConstRef(bi::udp::endpoint(), bytesConstRef(&s.out()))); + BOOST_REQUIRE(p.version = 0); +} + BOOST_AUTO_TEST_CASE(test_neighbours_packet) { KeyPair k = KeyPair::create(); -- cgit v1.2.3