From dedc8d89c7580dbc296ab2d932d702135cd75517 Mon Sep 17 00:00:00 2001 From: CalDescent Date: Fri, 8 Oct 2021 12:51:02 +0100 Subject: [PATCH] Handle case when attempting to load a block from the archive by reference, but the referenced block is in the main block repository, not the archive. This is the case with the genesis block. Should fix issue where no block summaries were returned when syncing from block 1 --- .../repository/hsqldb/HSQLDBBlockArchiveRepository.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/qortal/repository/hsqldb/HSQLDBBlockArchiveRepository.java b/src/main/java/org/qortal/repository/hsqldb/HSQLDBBlockArchiveRepository.java index 32270213..46008c25 100644 --- a/src/main/java/org/qortal/repository/hsqldb/HSQLDBBlockArchiveRepository.java +++ b/src/main/java/org/qortal/repository/hsqldb/HSQLDBBlockArchiveRepository.java @@ -71,6 +71,10 @@ public class HSQLDBBlockArchiveRepository implements BlockArchiveRepository { @Override public BlockData fromReference(byte[] reference) throws DataException { BlockData referenceBlock = this.repository.getBlockArchiveRepository().fromSignature(reference); + if (referenceBlock == null) { + // Try the main block repository. Needed for genesis block. + referenceBlock = this.repository.getBlockRepository().fromSignature(reference); + } if (referenceBlock != null) { int height = referenceBlock.getHeight(); if (height > 0) {