|
|
@ -254,7 +254,8 @@ void EthereumHost::onPeerStatus(EthereumPeer* _peer) |
|
|
|
estimatePeerHashes(_peer); |
|
|
|
else |
|
|
|
{ |
|
|
|
_peer->m_expectedHashes = (unsigned)_peer->m_latestBlockNumber - m_chain.number(); |
|
|
|
if (_peer->m_latestBlockNumber > m_chain.number()) |
|
|
|
_peer->m_expectedHashes = (unsigned)_peer->m_latestBlockNumber - m_chain.number(); |
|
|
|
if (m_hashMan.chainSize() < _peer->m_expectedHashes) |
|
|
|
m_hashMan.resetToRange(m_chain.number() + 1, _peer->m_expectedHashes); |
|
|
|
} |
|
|
@ -287,6 +288,7 @@ void EthereumHost::onPeerHashes(EthereumPeer* _peer, h256s const& _hashes, bool |
|
|
|
{ |
|
|
|
if (_hashes.empty()) |
|
|
|
{ |
|
|
|
_peer->m_hashSub.doneFetch(); |
|
|
|
continueSync(); |
|
|
|
return; |
|
|
|
} |
|
|
@ -399,6 +401,7 @@ void EthereumHost::onPeerBlocks(EthereumPeer* _peer, RLP const& _r) |
|
|
|
// Got to this peer's latest block - just give up.
|
|
|
|
clog(NetNote) << "Finishing blocks fetch..."; |
|
|
|
// NOTE: need to notify of giving up on chain-hashes, too, altering state as necessary.
|
|
|
|
_peer->m_sub.doneFetch(); |
|
|
|
_peer->setIdle(); |
|
|
|
return; |
|
|
|
} |
|
|
@ -693,3 +696,4 @@ HashChainStatus EthereumHost::status() |
|
|
|
return HashChainStatus { static_cast<unsigned>(m_hashMan.chainSize()), static_cast<unsigned>(m_hashMan.gotCount()), false }; |
|
|
|
return HashChainStatus { m_estimatedHashes, static_cast<unsigned>(m_hashes.size()), true }; |
|
|
|
} |
|
|
|
|
|
|
|