mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-25 07:07:39 +01:00
Notify even if nothing to download, resolves issue 90
This commit is contained in:
parent
415f8e611c
commit
a88bb0bc1c
2 changed files with 5 additions and 1 deletions
|
@ -40,6 +40,10 @@ public class DownloadListener extends AbstractPeerEventListener {
|
||||||
public void onChainDownloadStarted(Peer peer, int blocksLeft) {
|
public void onChainDownloadStarted(Peer peer, int blocksLeft) {
|
||||||
startDownload(blocksLeft);
|
startDownload(blocksLeft);
|
||||||
originalBlocksLeft = blocksLeft;
|
originalBlocksLeft = blocksLeft;
|
||||||
|
if (blocksLeft == 0) {
|
||||||
|
doneDownload();
|
||||||
|
done.release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -412,7 +412,7 @@ public class Peer {
|
||||||
setDownloadData(true);
|
setDownloadData(true);
|
||||||
// TODO: peer might still have blocks that we don't have, and even have a heavier
|
// 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.
|
// chain even if the chain block count is lower.
|
||||||
if (getPeerBlocksToGet() > 0) {
|
if (getPeerBlocksToGet() >= 0) {
|
||||||
for (PeerEventListener listener : eventListeners) {
|
for (PeerEventListener listener : eventListeners) {
|
||||||
synchronized (listener) {
|
synchronized (listener) {
|
||||||
listener.onChainDownloadStarted(this, getPeerBlocksToGet());
|
listener.onChainDownloadStarted(this, getPeerBlocksToGet());
|
||||||
|
|
Loading…
Add table
Reference in a new issue