From 3aa5fef8ab78867d352ea7fbb6941f4ecfe56233 Mon Sep 17 00:00:00 2001
From: woodser <woodser@protonmail.com>
Date: Sun, 30 Jul 2023 07:27:35 -0400
Subject: [PATCH] fix concurrent modification exception in
 ArbitrationDisputeList

---
 .../dispute/arbitration/ArbitrationDisputeList.java    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/core/src/main/java/haveno/core/support/dispute/arbitration/ArbitrationDisputeList.java b/core/src/main/java/haveno/core/support/dispute/arbitration/ArbitrationDisputeList.java
index e040a34f..d40943ef 100644
--- a/core/src/main/java/haveno/core/support/dispute/arbitration/ArbitrationDisputeList.java
+++ b/core/src/main/java/haveno/core/support/dispute/arbitration/ArbitrationDisputeList.java
@@ -57,11 +57,11 @@ public final class ArbitrationDisputeList extends DisputeList<Dispute> {
 
     @Override
     public Message toProtoMessage() {
-
-        forEach(dispute -> checkArgument(dispute.getSupportType().equals(SupportType.ARBITRATION), "Support type has to be ARBITRATION"));
-
-        return protobuf.PersistableEnvelope.newBuilder().setArbitrationDisputeList(protobuf.ArbitrationDisputeList.newBuilder()
-                .addAllDispute(ProtoUtil.collectionToProto(getList(), protobuf.Dispute.class))).build();
+        synchronized (this.list) {
+            forEach(dispute -> checkArgument(dispute.getSupportType().equals(SupportType.ARBITRATION), "Support type has to be ARBITRATION"));
+            return protobuf.PersistableEnvelope.newBuilder().setArbitrationDisputeList(protobuf.ArbitrationDisputeList.newBuilder()
+                    .addAllDispute(ProtoUtil.collectionToProto(getList(), protobuf.Dispute.class))).build();
+        }
     }
 
     public static ArbitrationDisputeList fromProto(protobuf.ArbitrationDisputeList proto,