mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-08-02 00:31:24 +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.
|
* downloaded the same number of blocks that the peer advertised having in its version handshake message.
|
||||||
*/
|
*/
|
||||||
public void startBlockChainDownload() throws IOException {
|
public void startBlockChainDownload() throws IOException {
|
||||||
for (PeerEventListener listener : eventListeners) {
|
// TODO: peer might still have blocks that we don't have, and even have a heavier
|
||||||
synchronized (listener) {
|
// chain even if the chain block count is lower.
|
||||||
listener.onChainDownloadStarted(this, getPeerBlocksToGet());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getPeerBlocksToGet() > 0) {
|
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.
|
// When we just want as many blocks as possible, we can set the target hash to zero.
|
||||||
blockChainDownload(Sha256Hash.ZERO_HASH);
|
blockChainDownload(Sha256Hash.ZERO_HASH);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user