From 59c9da7f003752fa28efff71a6b1cd0091bdf999 Mon Sep 17 00:00:00 2001 From: Tim Hughes Date: Fri, 21 Mar 2014 11:20:47 +0000 Subject: [PATCH] Workarounds for https://github.com/ethereum/cpp-ethereum/issues/128 and https://github.com/ethereum/cpp-ethereum/issues/129 --- libethereum/PeerNetwork.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libethereum/PeerNetwork.cpp b/libethereum/PeerNetwork.cpp index a4e3c6317..02be9bc2c 100644 --- a/libethereum/PeerNetwork.cpp +++ b/libethereum/PeerNetwork.cpp @@ -316,7 +316,9 @@ bool PeerSession::interpret(RLP const& _r) else clogS(NetMessageDetail) << "Known parent " << bi.parentHash << " of block " << h; } - if (used) // we received some - check if there's any more + // TJH: This check stops us downloading a forked chain when we already have the + // beginning of the fork. + //if (used) // we received some - check if there's any more { RLPStream s; prep(s).appendList(3); @@ -1021,7 +1023,11 @@ bool PeerServer::sync(BlockChain& _bc, TransactionQueue& _tq, Overlay& _o) if (it == m_incomingBlocks.begin()) break; } - if (!n && accepted) + // TJH: If we don't keep trying we'll leave lots of usable blocks + // in m_unknownParents until an incoming block arrives. Should + // probably replace with a better algorithm. + // if (!n && accepted) + if (accepted) { for (auto i: m_unknownParentBlocks) m_incomingBlocks.push_back(i);