Browse Source

Use a better method to detect if a transactions table in need of a rebuild.

Should handle cases where a previous rebuild didn't fully complete, or missed a block.
pull/123/head
CalDescent 1 year ago
parent
commit
95d72866e9
  1. 6
      src/main/java/org/qortal/repository/RepositoryManager.java

6
src/main/java/org/qortal/repository/RepositoryManager.java

@ -71,11 +71,11 @@ public abstract class RepositoryManager {
}
public static boolean needsTransactionSequenceRebuild(Repository repository) throws DataException {
// Check if we have any unpopulated block_sequence values for the first 1000 blocks
// Check if we have any transactions without a block_sequence
List<byte[]> testSignatures = repository.getTransactionRepository().getSignaturesMatchingCustomCriteria(
null, Arrays.asList("block_height < 1000 AND block_sequence IS NULL"), new ArrayList<>());
null, Arrays.asList("block_height IS NOT NULL AND block_sequence IS NULL"), new ArrayList<>());
if (testSignatures.isEmpty()) {
// block_sequence already populated for the first 1000 blocks, so assume complete.
// block_sequence intact, so assume complete
return false;
}

Loading…
Cancel
Save