diff --git a/core/src/main/java/bisq/core/dao/burningman/accounting/storage/BurningManAccountingStore.java b/core/src/main/java/bisq/core/dao/burningman/accounting/storage/BurningManAccountingStore.java index cc80331f926..fa9095daa84 100644 --- a/core/src/main/java/bisq/core/dao/burningman/accounting/storage/BurningManAccountingStore.java +++ b/core/src/main/java/bisq/core/dao/burningman/accounting/storage/BurningManAccountingStore.java @@ -17,7 +17,6 @@ package bisq.core.dao.burningman.accounting.storage; - import bisq.core.dao.burningman.accounting.blockchain.AccountingBlock; import bisq.core.dao.burningman.accounting.exceptions.BlockHashNotConnectingException; import bisq.core.dao.burningman.accounting.exceptions.BlockHeightNotConnectingException; @@ -160,9 +159,17 @@ private void purgeLast10Blocks() { } public Message toProtoMessage() { + List blocksCopy; + Lock readLock = readWriteLock.readLock(); + readLock.lock(); + try { + blocksCopy = new ArrayList<>(blocks); + } finally { + readLock.unlock(); + } return protobuf.PersistableEnvelope.newBuilder() .setBurningManAccountingStore(protobuf.BurningManAccountingStore.newBuilder() - .addAllBlocks(blocks.stream() + .addAllBlocks(blocksCopy.stream() .map(AccountingBlock::toProtoMessage) .collect(Collectors.toList()))) .build();