diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index 2d904ed7f..d07bb71f3 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -439,7 +439,7 @@ void BlockChain::checkConsistency() h256 h((byte const*)it->key().data(), h256::ConstructFromPointer); auto dh = details(h); auto p = dh.parent; - if (p != h256() && p != m_genesisHash) + if (p != h256() && p != m_genesisHash) // TODO: for some reason the genesis details with the children get squished. not sure why. { auto dp = details(p); if (asserts(contains(dp.children, h))) diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index 5817aa434..6c10524ca 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -288,6 +288,8 @@ void EthereumPeer::attemptSync() bool EthereumPeer::interpret(unsigned _id, RLP const& _r) { + try + { switch (_id) { case StatusPacket: @@ -509,5 +511,11 @@ bool EthereumPeer::interpret(unsigned _id, RLP const& _r) default: return false; } + } + catch (std::exception const& _e) + { + clogS(NetWarn) << "Peer causing an exception:" << _e.what() << _r; + } + return true; } diff --git a/libp2p/Session.cpp b/libp2p/Session.cpp index 1ab4ca123..327233820 100644 --- a/libp2p/Session.cpp +++ b/libp2p/Session.cpp @@ -297,6 +297,7 @@ bool Session::interpret(RLP const& _r) peerAddress = bi::address_v4(_r[i][0].toHash>().asArray()); else { + cwarn << "Received bad peer packet:" << _r; disconnect(BadProtocol); return true; } @@ -372,7 +373,7 @@ bool Session::interpret(RLP const& _r) } catch (std::exception const& _e) { - clogS(NetWarn) << "Peer causing an exception:" << _e.what(); + clogS(NetWarn) << "Peer causing an exception:" << _e.what() << _r; disconnect(BadProtocol); return true; } @@ -579,6 +580,7 @@ void Session::doRead() if (!interpret(r)) { // error - bad protocol + clogS(NetWarn) << "Couldn't interpret packet." << RLP(r); disconnect(BadProtocol); return; }