diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index 5aeeb3f82..e530c7e66 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -728,7 +728,9 @@ bytes Host::saveNetwork() const RLPStream ret(3); ret << dev::p2p::c_protocolVersion << m_alias.secret(); - ret.appendList(count).appendRaw(network.out(), count); + ret.appendList(count); + if (count) + ret.appendRaw(network.out(), count); return ret.out(); } @@ -769,7 +771,7 @@ void Host::restoreNetwork(bytesConstRef _b) { shared_ptr p = make_shared(); p->id = id; - p->required = i[2].toInt(); + p->required = i[3].toInt(); p->m_lastConnected = chrono::system_clock::time_point(chrono::seconds(i[4].toInt())); p->m_lastAttempted = chrono::system_clock::time_point(chrono::seconds(i[5].toInt())); p->m_failedAttempts = i[6].toInt();