|
@ -74,13 +74,20 @@ void EthereumHost::noteHavePeerState(EthereumPeer* _who) |
|
|
{ |
|
|
{ |
|
|
clog(NetAllDetail) << "Have peer state."; |
|
|
clog(NetAllDetail) << "Have peer state."; |
|
|
|
|
|
|
|
|
|
|
|
// TODO: FIX: BUG: Better state management!
|
|
|
|
|
|
|
|
|
// if already downloading hash-chain, ignore.
|
|
|
// if already downloading hash-chain, ignore.
|
|
|
if (m_grabbing != Grabbing::Nothing) |
|
|
if (m_grabbing != Grabbing::Nothing) |
|
|
|
|
|
{ |
|
|
|
|
|
for (auto const& i: peers()) |
|
|
|
|
|
if (i->cap<EthereumPeer>()->m_grabbing == m_grabbing || m_grabbing == Grabbing::State) |
|
|
{ |
|
|
{ |
|
|
clog(NetAllDetail) << "Already downloading chain. Just set to help out."; |
|
|
clog(NetAllDetail) << "Already downloading chain. Just set to help out."; |
|
|
_who->ensureGettingChain(); |
|
|
_who->ensureGettingChain(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
m_grabbing = Grabbing::Nothing; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// otherwise check to see if we should be downloading...
|
|
|
// otherwise check to see if we should be downloading...
|
|
|
_who->tryGrabbingHashChain(); |
|
|
_who->tryGrabbingHashChain(); |
|
|