diff --git a/src/main/java/org/qortal/repository/BlockArchiveReader.java b/src/main/java/org/qortal/repository/BlockArchiveReader.java index 47e4e7fc..b730ef87 100644 --- a/src/main/java/org/qortal/repository/BlockArchiveReader.java +++ b/src/main/java/org/qortal/repository/BlockArchiveReader.java @@ -23,7 +23,7 @@ import java.util.*; public class BlockArchiveReader { private static BlockArchiveReader instance; - private Map> fileListCache = Collections.synchronizedMap(new HashMap<>()); + private Map> fileListCache; private static final Logger LOGGER = LogManager.getLogger(BlockArchiveReader.class); @@ -67,7 +67,7 @@ public class BlockArchiveReader { } public Triple, List> fetchBlockAtHeight(int height) { - if (this.fileListCache.isEmpty()) { + if (this.fileListCache == null || this.fileListCache.isEmpty()) { this.fetchFileList(); } @@ -94,7 +94,7 @@ public class BlockArchiveReader { public Triple, List> fetchBlockWithSignature( byte[] signature, Repository repository) { - if (this.fileListCache.isEmpty()) { + if (this.fileListCache == null || this.fileListCache.isEmpty()) { this.fetchFileList(); } @@ -167,7 +167,7 @@ public class BlockArchiveReader { public byte[] fetchSerializedBlockBytesForSignature(byte[] signature, boolean includeHeightPrefix, Repository repository) { - if (this.fileListCache.isEmpty()) { + if (this.fileListCache == null || this.fileListCache.isEmpty()) { this.fetchFileList(); } @@ -278,7 +278,7 @@ public class BlockArchiveReader { } public void invalidateFileListCache() { - this.fileListCache.clear(); + this.fileListCache = null; } }