From 34e388949d36c78b3c6d12c18f00cc058f462867 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 7 Dec 2015 00:20:00 +0000 Subject: [PATCH] p2p: failure to load p2pstate.bin is not fatal anymore Clear any partially loaded data, and start with a default config --- src/p2p/net_node.inl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 067f6378d..6bbad0258 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -134,8 +134,17 @@ namespace nodetool p2p_data.open( state_file_path , std::ios_base::binary | std::ios_base::in); if(!p2p_data.fail()) { - boost::archive::binary_iarchive a(p2p_data); - a >> *this; + try + { + boost::archive::binary_iarchive a(p2p_data); + a >> *this; + } + catch (const std::exception &e) + { + LOG_ERROR("Failed to load p2p config file, falling back to default config"); + m_peerlist = peerlist_manager(); // it was probably half clobbered by the failed load + make_default_config(); + } }else { make_default_config();