From 56091064db569543a6b3ab24bdb1c75c7e15b956 Mon Sep 17 00:00:00 2001 From: arkpar Date: Wed, 8 Jul 2015 18:21:28 +0200 Subject: [PATCH] work around invalid NewBlock packet --- libethereum/BlockChainSync.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libethereum/BlockChainSync.cpp b/libethereum/BlockChainSync.cpp index 5dd1a97cb..6f19c2812 100644 --- a/libethereum/BlockChainSync.cpp +++ b/libethereum/BlockChainSync.cpp @@ -296,10 +296,14 @@ void BlockChainSync::onPeerNewBlock(std::shared_ptr _peer, RLP con case ImportResult::FutureTimeUnknown: case ImportResult::UnknownParent: + { logNewBlock(h); clog(NetMessageDetail) << "Received block with no known parent. Resyncing..."; - resetSyncFor(_peer, h, _r[1].toInt()); - break; + u256 totalDifficulty = _r[1].toInt(); + if (totalDifficulty > _peer->m_totalDifficulty) + resetSyncFor(_peer, h, totalDifficulty); + } + break; default:; }