mirror of
https://github.com/Qortal/qortal.git
synced 2025-06-04 15:26:58 +00:00
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.
This commit is contained in:
parent
aea1cc62c8
commit
95d72866e9
@ -71,11 +71,11 @@ public abstract class RepositoryManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean needsTransactionSequenceRebuild(Repository repository) throws DataException {
|
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(
|
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()) {
|
if (testSignatures.isEmpty()) {
|
||||||
// block_sequence already populated for the first 1000 blocks, so assume complete.
|
// block_sequence intact, so assume complete
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user