Refactor: Extract statement to var and return early

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
HenrikJannsen 2024-06-29 13:28:07 +07:00
parent 318803e4d9
commit 143d1e9cc6
No known key found for this signature in database
GPG Key ID: 02AA2BAE387C8307

View File

@ -220,7 +220,11 @@ public class DaoStateSnapshotService implements DaoSetupService, DaoStateListene
// Either we don't have a snapshot candidate yet, or if we have one the height at that snapshot candidate must be
// different to our current height.
if (daoStateCandidate == null || snapshotHeight != chainHeight) {
boolean noSnapshotCandidateOrDifferentHeight = daoStateCandidate == null || snapshotHeight != chainHeight;
if (!noSnapshotCandidateOrDifferentHeight) {
return;
}
// We protect to get called while we are not completed with persisting the daoState. This can take about
// 20 seconds, and it is not expected that we get triggered another snapshot event in that period, but this
// check guards that we would skip such calls.
@ -244,7 +248,6 @@ public class DaoStateSnapshotService implements DaoSetupService, DaoStateListene
createSnapshot();
}
}
}
private void persist() {
long ts = System.currentTimeMillis();