gracefully handle old pingnode packet

This commit is contained in:
subtly 2015-03-23 15:26:48 +01:00
parent 7d4c44f7f3
commit 272bd3c60c

11
net.cpp
View File

@ -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::seconds>((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();