From 63f364424cd18fc300593358561b40871bc96bdc Mon Sep 17 00:00:00 2001 From: HenrikJannsen Date: Sat, 29 Jun 2024 13:32:39 +0700 Subject: [PATCH] Refactor: Refactor statement and return early Signed-off-by: HenrikJannsen --- .../java/bisq/core/dao/state/DaoStateSnapshotService.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/bisq/core/dao/state/DaoStateSnapshotService.java b/core/src/main/java/bisq/core/dao/state/DaoStateSnapshotService.java index 27058cc59b..0cdcb639eb 100644 --- a/core/src/main/java/bisq/core/dao/state/DaoStateSnapshotService.java +++ b/core/src/main/java/bisq/core/dao/state/DaoStateSnapshotService.java @@ -218,10 +218,8 @@ public class DaoStateSnapshotService implements DaoSetupService, DaoStateListene return; } - // 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. - boolean noSnapshotCandidateOrDifferentHeight = daoStateCandidate == null || snapshotHeight != chainHeight; - if (!noSnapshotCandidateOrDifferentHeight) { + if (daoStateCandidate != null && snapshotHeight == chainHeight) { + log.error("snapshotHeight is same as chainHeight. This should never happen. chainHeight={}", chainHeight); return; }