Browse Source

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
v2.0-beta
CalDescent 3 years ago
parent
commit
dedc8d89c7
  1. 4
      src/main/java/org/qortal/repository/hsqldb/HSQLDBBlockArchiveRepository.java

4
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) {

Loading…
Cancel
Save