mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-31 20:11:23 +00:00
Do not callback if nothing to download from peer. Resolves issue 61
This commit is contained in:
@@ -366,13 +366,15 @@ public class Peer {
|
||||
* downloaded the same number of blocks that the peer advertised having in its version handshake message.
|
||||
*/
|
||||
public void startBlockChainDownload() throws IOException {
|
||||
for (PeerEventListener listener : eventListeners) {
|
||||
synchronized (listener) {
|
||||
listener.onChainDownloadStarted(this, getPeerBlocksToGet());
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: peer might still have blocks that we don't have, and even have a heavier
|
||||
// chain even if the chain block count is lower.
|
||||
if (getPeerBlocksToGet() > 0) {
|
||||
for (PeerEventListener listener : eventListeners) {
|
||||
synchronized (listener) {
|
||||
listener.onChainDownloadStarted(this, getPeerBlocksToGet());
|
||||
}
|
||||
}
|
||||
|
||||
// When we just want as many blocks as possible, we can set the target hash to zero.
|
||||
blockChainDownload(Sha256Hash.ZERO_HASH);
|
||||
}
|
||||
|
Reference in New Issue
Block a user