Parse block only if height is right

This commit is contained in:
sqrrm 2019-07-14 17:57:56 +02:00
parent 9d2740eb32
commit 5c15e29f49
No known key found for this signature in database
GPG key ID: 45235F9EF87089EC

View file

@ -239,7 +239,9 @@ public abstract class BsqNode implements DaoSetupService {
// We take only first element after sorting (so it is the block with the next height) to avoid that
// we would repeat calls in recursions in case we would iterate the list.
pendingBlocks.sort(Comparator.comparing(RawBlock::getHeight));
doParseBlock(pendingBlocks.get(0));
RawBlock nextPending = pendingBlocks.get(0);
if (nextPending.getHeight() == daoStateService.getChainHeight() + 1)
doParseBlock(nextPending);
}
return Optional.of(block);