Skip to content

Commit b7b1129

Browse files
authored
Fix bug with pendingEventOrdering: "chronological" (#3382)
If we don't do this, then we end up trying to match the MAC on our own `m.key.verification.mac`, which of course fails.
1 parent 0fa9528 commit b7b1129

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/crypto/verification/request/InRoomChannel.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,17 @@ export class InRoomChannel implements IVerificationChannel {
208208
this.requestEventId = InRoomChannel.getTransactionId(event);
209209
}
210210

211+
// With pendingEventOrdering: "chronological", we will see events that have been sent but not yet reflected
212+
// back via /sync. These are "local echoes" and are identifiable by their txnId
213+
const isLocalEcho = !!event.getTxnId();
214+
215+
// Alternatively, we may see an event that we sent that is reflected back via /sync. These are "remote echoes"
216+
// and have a transaction ID in the "unsigned" data
211217
const isRemoteEcho = !!event.getUnsigned().transaction_id;
218+
212219
const isSentByUs = event.getSender() === this.client.getUserId();
213220

214-
return request.handleEvent(type, event, isLiveEvent, isRemoteEcho, isSentByUs);
221+
return request.handleEvent(type, event, isLiveEvent, isLocalEcho || isRemoteEcho, isSentByUs);
215222
}
216223

217224
/**

0 commit comments

Comments
 (0)