From 76fc56f1c919869fb0d2ccc70c154b6ae066532a Mon Sep 17 00:00:00 2001 From: CalDescent Date: Fri, 11 Mar 2022 13:07:16 +0000 Subject: [PATCH] Fetch the file list in getFilenameForHeight() if needed. --- src/main/java/org/qortal/repository/BlockArchiveReader.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/qortal/repository/BlockArchiveReader.java b/src/main/java/org/qortal/repository/BlockArchiveReader.java index b730ef87..fa7fad26 100644 --- a/src/main/java/org/qortal/repository/BlockArchiveReader.java +++ b/src/main/java/org/qortal/repository/BlockArchiveReader.java @@ -145,6 +145,10 @@ public class BlockArchiveReader { } private String getFilenameForHeight(int height) { + if (this.fileListCache == null || this.fileListCache.isEmpty()) { + this.fetchFileList(); + } + Iterator it = this.fileListCache.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); @@ -166,7 +170,6 @@ public class BlockArchiveReader { } public byte[] fetchSerializedBlockBytesForSignature(byte[] signature, boolean includeHeightPrefix, Repository repository) { - if (this.fileListCache == null || this.fileListCache.isEmpty()) { this.fetchFileList(); }