Skip to content

Commit

Permalink
fixed comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Hristiyan Mitov committed Feb 7, 2025
1 parent 3f10834 commit 816ca38
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/main/java/com/limechain/grandpa/round/FinalizeStage.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.limechain.grandpa.round;

import com.limechain.exception.grandpa.GrandpaGenericException;
import com.limechain.network.protocol.warp.dto.BlockHeader;
import lombok.extern.java.Log;

Expand Down Expand Up @@ -35,12 +36,16 @@ public void end(GrandpaRound round) {
}

private boolean isRoundReadyToBeFinalized(GrandpaRound round) {
BlockHeader finalized = round.getFinalizedBlock();
BlockHeader prevBestFinalCandidate = round.getPrevBestFinalCandidate();

if (finalized == null || prevBestFinalCandidate == null) {
BlockHeader finalized;
try {
finalized = round.getFinalizedBlock();
} catch (GrandpaGenericException e) {
return false;
}
return finalized.getBlockNumber().compareTo(prevBestFinalCandidate.getBlockNumber()) >= 0;

BlockHeader prevBestFinalCandidate = round.getPrevBestFinalCandidate();

return prevBestFinalCandidate != null
&& finalized.getBlockNumber().compareTo(prevBestFinalCandidate.getBlockNumber()) >= 0;
}
}

0 comments on commit 816ca38

Please sign in to comment.