diff --git a/core/src/main/java/org/bitcoinj/core/PeerGroup.java b/core/src/main/java/org/bitcoinj/core/PeerGroup.java index 9522763f475..7729ffe30b2 100644 --- a/core/src/main/java/org/bitcoinj/core/PeerGroup.java +++ b/core/src/main/java/org/bitcoinj/core/PeerGroup.java @@ -1242,6 +1242,7 @@ public ListenableFuture stopAsync() { public void run() { try { log.info("Stopping ..."); + setDownloadPeer(null); // Blocking close of all sockets. channels.stopAsync(); channels.awaitTerminated(); @@ -1841,12 +1842,6 @@ protected void handlePeerDeath(final Peer peer, @Nullable Throwable exception) { if (newDownloadPeer != null) { setDownloadPeer(newDownloadPeer); - // When using BlockingClient we get errors at shutdown caused by - // startBlockChainDownloadFromPeer() - // We add another check to terminate here if we have been shut down already - if (!isRunning()) - return; - if (downloadListener != null) { startBlockChainDownloadFromPeer(newDownloadPeer); }