diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java b/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java index ca084b4bc..8062a607f 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java @@ -619,10 +619,6 @@ public class AccountsManager { return Optional.of("number"); } - if (databaseAccount.getVersion() != dynamoAccount.getVersion()) { - return Optional.of("version"); - } - if (!Objects.equals(databaseAccount.getIdentityKey(), dynamoAccount.getIdentityKey())) { return Optional.of("identityKey"); } @@ -659,21 +655,27 @@ public class AccountsManager { return Optional.of("discoverableByPhoneNumber"); } - try { - if (databaseAccount.getMasterDevice().isPresent() && dynamoAccount.getMasterDevice().isPresent()) { - if (!Objects.equals(databaseAccount.getMasterDevice().get().getSignedPreKey(), dynamoAccount.getMasterDevice().get().getSignedPreKey())) { - return Optional.of("masterDeviceSignedPreKey"); - } - - if (!Objects.equals(databaseAccount.getMasterDevice().get().getPushTimestamp(), dynamoAccount.getMasterDevice().get().getPushTimestamp())) { - return Optional.of("masterDevicePushTimestamp"); - } + if (databaseAccount.getMasterDevice().isPresent() && dynamoAccount.getMasterDevice().isPresent()) { + if (!Objects.equals(databaseAccount.getMasterDevice().get().getSignedPreKey(), + dynamoAccount.getMasterDevice().get().getSignedPreKey())) { + return Optional.of("masterDeviceSignedPreKey"); } + if (!Objects.equals(databaseAccount.getMasterDevice().get().getPushTimestamp(), + dynamoAccount.getMasterDevice().get().getPushTimestamp())) { + return Optional.of("masterDevicePushTimestamp"); + } + } + + try { if (!serializedEquals(databaseAccount.getDevices(), dynamoAccount.getDevices())) { return Optional.of("devices"); } + if (databaseAccount.getVersion() != dynamoAccount.getVersion()) { + return Optional.of("version"); + } + if (!serializedEquals(databaseAccount, dynamoAccount)) { return Optional.of("serialization"); }