diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index 1dd97d948..b3bc3163f 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -703,7 +703,7 @@ bytes Host::saveNetwork() const if (chrono::system_clock::now() - p.m_lastConnected < chrono::seconds(3600 * 48) && endpoint.port() > 0 && endpoint.port() < /*49152*/32768 && p.id != id() && !isPrivateAddress(p.endpoint.udp.address()) && !isPrivateAddress(endpoint.address())) { network.appendList(10); - network << endpoint.port() << p.id << p.required + network << endpoint.address().to_v4().to_bytes() << endpoint.port() << p.id << p.required << chrono::duration_cast(p.m_lastConnected.time_since_epoch()).count() << chrono::duration_cast(p.m_lastAttempted.time_since_epoch()).count() << p.m_failedAttempts << (unsigned)p.m_lastDisconnect << p.m_score << p.m_rating; diff --git a/test/peer.cpp b/test/peer.cpp index 2aeb99469..6b25aa959 100644 --- a/test/peer.cpp +++ b/test/peer.cpp @@ -102,6 +102,12 @@ BOOST_AUTO_TEST_CASE(save_nodes) BOOST_REQUIRE(r[0].toInt() == dev::p2p::c_protocolVersion); BOOST_REQUIRE_EQUAL(r[1].toBytes().size(), 32); // secret BOOST_REQUIRE_EQUAL(r[2].itemCount(), 5); + + for (auto i: r[2]) + { + BOOST_REQUIRE(i.itemCount() == 3 || i.itemCount() == 10); + BOOST_REQUIRE(i[0].itemCount() == 4 || i[0].itemCount() == 16); + } } BOOST_AUTO_TEST_SUITE_END()