Skip to content

Commit

Permalink
Merge pull request #7297 from alvasw/fix_bitcoin_core_peer_selection
Browse files Browse the repository at this point in the history
BtcNetworkConfig: Shuffle Bitcoin Core peers
  • Loading branch information
alejandrogarcia83 authored Nov 20, 2024
2 parents 6def505 + 56a0bef commit 33e760b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/main/java/bisq/core/btc/nodes/BtcNetworkConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import com.runjva.sourceforge.jsocks.protocol.Socks5Proxy;

import java.util.Collections;
import java.util.List;

import org.slf4j.Logger;
Expand Down Expand Up @@ -56,7 +57,8 @@ public BtcNetworkConfig(WalletConfig delegate, NetworkParameters parameters, int
public void proposePeers(List<PeerAddress> peers) {
if (!peers.isEmpty()) {
log.info("You connect with peerAddresses: {}", peers);
PeerAddress[] peerAddresses = peers.toArray(new PeerAddress[peers.size()]);
Collections.shuffle(peers);
PeerAddress[] peerAddresses = peers.toArray(new PeerAddress[0]);
delegate.setPeerNodes(peerAddresses);
} else if (proxy != null) {
if (log.isWarnEnabled()) {
Expand Down

0 comments on commit 33e760b

Please sign in to comment.