Allow read-only transaction when not marking message as sent.

This commit is contained in:
akwizgran
2022-08-03 16:36:32 +01:00
parent 8657216345
commit 16fc4f4527
2 changed files with 5 additions and 1 deletions

View File

@@ -746,7 +746,9 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
public Message getMessageToSend(Transaction transaction, ContactId c,
MessageId m, long maxLatency, boolean markAsSent)
throws DbException {
if (transaction.isReadOnly()) throw new IllegalArgumentException();
if (markAsSent && transaction.isReadOnly()) {
throw new IllegalArgumentException();
}
T txn = unbox(transaction);
if (!db.containsContact(txn, c))
throw new NoSuchContactException();