From 59b2a1121b83030e86554c745aff0368095213e6 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 4 Jan 2024 20:10:25 -0500 Subject: [PATCH] fix concurrent modification exception in peer manager --- p2p/src/main/java/haveno/network/p2p/peers/PeerManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/p2p/src/main/java/haveno/network/p2p/peers/PeerManager.java b/p2p/src/main/java/haveno/network/p2p/peers/PeerManager.java index 6b7bf80157..2c7fdd6caf 100644 --- a/p2p/src/main/java/haveno/network/p2p/peers/PeerManager.java +++ b/p2p/src/main/java/haveno/network/p2p/peers/PeerManager.java @@ -774,7 +774,9 @@ public final class PeerManager implements ConnectionListener, PersistedDataHost // If not found in connection we look up if we got the Capabilities set from any of the // reported or persisted peers Set persistedAndReported = new HashSet<>(getPersistedPeers()); - persistedAndReported.addAll(getReportedPeers()); + synchronized (reportedPeers) { + persistedAndReported.addAll(reportedPeers); + } Optional candidate = persistedAndReported.stream() .filter(peer -> peer.getNodeAddress().equals(peersNodeAddress)) .filter(peer -> !peer.getCapabilities().isEmpty())