diff --git a/libethereum/BlockChainSync.cpp b/libethereum/BlockChainSync.cpp index bcc7f72f3..eb4514731 100644 --- a/libethereum/BlockChainSync.cpp +++ b/libethereum/BlockChainSync.cpp @@ -402,7 +402,7 @@ void PV60Sync::transition(EthereumPeer* _peer, SyncState _s, bool _force, bool _ clog(NetWarn) << "Bad state: asking for Hashes yet not syncing!"; return; } - if (shouldGrabBlocks()) + if (shouldGrabBlocks(_peer)) { clog(NetNote) << "Difficulty of hashchain HIGHER. Grabbing" << m_syncingNeededBlocks.size() << "blocks [latest now" << m_syncingLatestHash << ", was" << host().latestBlockSent() << "]"; downloadMan().resetToChain(m_syncingNeededBlocks); @@ -504,10 +504,10 @@ bool PV60Sync::isSyncing(EthereumPeer* _peer) const return m_syncer == _peer; } -bool PV60Sync::shouldGrabBlocks() const +bool PV60Sync::shouldGrabBlocks(EthereumPeer* _peer) const { - auto td = m_syncingTotalDifficulty; - auto lh = m_syncingLatestHash; + auto td = _peer->m_totalDifficulty; + auto lh = _peer->m_latestHash; auto ctd = host().chain().details().totalDifficulty; if (m_syncingNeededBlocks.empty()) diff --git a/libethereum/BlockChainSync.h b/libethereum/BlockChainSync.h index 1337c5c90..e981a344e 100644 --- a/libethereum/BlockChainSync.h +++ b/libethereum/BlockChainSync.h @@ -174,8 +174,8 @@ private: /// Do we presently need syncing with this peer? bool needsSyncing(EthereumPeer* _peer) const; - /// Check whether the session should bother grabbing blocks. - bool shouldGrabBlocks() const; + /// Check whether the session should bother grabbing blocks from a peer. + bool shouldGrabBlocks(EthereumPeer* _peer) const; /// Attempt to begin syncing with the peer; first check the peer has a more difficlult chain to download, then start asking for hashes, then move to blocks void attemptSync(EthereumPeer* _peer);