Fix to always update recipientsMerged map when merging recipients

This commit is contained in:
AsamK 2021-12-03 14:25:07 +01:00
parent f65f0e3873
commit 855d06dc76

View file

@ -309,9 +309,6 @@ public class RecipientStore implements RecipientResolver, ContactsStore, Profile
final Pair<RecipientId, Optional<RecipientId>> pair; final Pair<RecipientId, Optional<RecipientId>> pair;
synchronized (recipients) { synchronized (recipients) {
pair = resolveRecipientLocked(address, isHighTrust); pair = resolveRecipientLocked(address, isHighTrust);
if (pair.second().isPresent()) {
recipientsMerged.put(pair.second().get(), pair.first());
}
} }
if (pair.second().isPresent()) { if (pair.second().isPresent()) {
@ -378,6 +375,7 @@ public class RecipientStore implements RecipientResolver, ContactsStore, Profile
logger.debug("Got separate recipients for high trust number and uuid, need to merge them"); logger.debug("Got separate recipients for high trust number and uuid, need to merge them");
updateRecipientAddressLocked(byUuid.get().getRecipientId(), address); updateRecipientAddressLocked(byUuid.get().getRecipientId(), address);
mergeRecipientsLocked(byUuid.get().getRecipientId(), byNumber.get().getRecipientId()); mergeRecipientsLocked(byUuid.get().getRecipientId(), byNumber.get().getRecipientId());
recipientsMerged.put(byNumber.get().getRecipientId(), byUuid.get().getRecipientId());
return new Pair<>(byUuid.get().getRecipientId(), byNumber.map(Recipient::getRecipientId)); return new Pair<>(byUuid.get().getRecipientId(), byNumber.map(Recipient::getRecipientId));
} }