mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-08-01 12:31:23 +00:00
PeerGroup: Fix NullPointerException in handleNewPeer() if no download peer could be selected.
This commit is contained in:
@@ -1515,13 +1515,16 @@ public class PeerGroup implements TransactionBroadcaster {
|
|||||||
for (Wallet wallet : wallets)
|
for (Wallet wallet : wallets)
|
||||||
peer.addWallet(wallet);
|
peer.addWallet(wallet);
|
||||||
if (downloadPeer == null) {
|
if (downloadPeer == null) {
|
||||||
|
Peer newDownloadPeer = selectDownloadPeer(peers);
|
||||||
|
if (newDownloadPeer != null) {
|
||||||
|
setDownloadPeer(newDownloadPeer);
|
||||||
// Kick off chain download if we aren't already doing it.
|
// Kick off chain download if we aren't already doing it.
|
||||||
setDownloadPeer(selectDownloadPeer(peers));
|
|
||||||
boolean shouldDownloadChain = downloadListener != null && chain != null;
|
boolean shouldDownloadChain = downloadListener != null && chain != null;
|
||||||
if (shouldDownloadChain) {
|
if (shouldDownloadChain) {
|
||||||
startBlockChainDownloadFromPeer(downloadPeer);
|
startBlockChainDownloadFromPeer(downloadPeer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Make sure the peer knows how to upload transactions that are requested from us.
|
// Make sure the peer knows how to upload transactions that are requested from us.
|
||||||
peer.addBlocksDownloadedEventListener(Threading.SAME_THREAD, peerListener);
|
peer.addBlocksDownloadedEventListener(Threading.SAME_THREAD, peerListener);
|
||||||
peer.addGetDataEventListener(Threading.SAME_THREAD, peerListener);
|
peer.addGetDataEventListener(Threading.SAME_THREAD, peerListener);
|
||||||
|
Reference in New Issue
Block a user