Fetch the file list in getFilenameForHeight() if needed.

This commit is contained in:
CalDescent 2022-03-11 13:07:16 +00:00
parent 8e59aa2885
commit 76fc56f1c9

View File

@ -145,6 +145,10 @@ public class BlockArchiveReader {
} }
private String getFilenameForHeight(int height) { private String getFilenameForHeight(int height) {
if (this.fileListCache == null || this.fileListCache.isEmpty()) {
this.fetchFileList();
}
Iterator it = this.fileListCache.entrySet().iterator(); Iterator it = this.fileListCache.entrySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
Map.Entry pair = (Map.Entry) it.next(); Map.Entry pair = (Map.Entry) it.next();
@ -166,7 +170,6 @@ public class BlockArchiveReader {
} }
public byte[] fetchSerializedBlockBytesForSignature(byte[] signature, boolean includeHeightPrefix, Repository repository) { public byte[] fetchSerializedBlockBytesForSignature(byte[] signature, boolean includeHeightPrefix, Repository repository) {
if (this.fileListCache == null || this.fileListCache.isEmpty()) { if (this.fileListCache == null || this.fileListCache.isEmpty()) {
this.fetchFileList(); this.fetchFileList();
} }