verificationhelper/request: check txn ID is different before sending cancellations
Some checks are pending
Go / Lint (latest) (push) Waiting to run
Go / Build (old, libolm) (push) Waiting to run
Go / Build (latest, libolm) (push) Waiting to run
Go / Build (old, goolm) (push) Waiting to run
Go / Build (latest, goolm) (push) Waiting to run

This will allow it to fallthrought to the correct error which is that we
received a new verification request for the same transaction ID.

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
Sumner Evans 2024-10-17 14:10:26 -06:00
commit 3f08ef0d57
No known key found for this signature in database

View file

@ -690,7 +690,7 @@ func (vh *VerificationHelper) onVerificationRequest(ctx context.Context, evt *ev
TheirSupportedMethods: verificationRequest.Methods,
}
for existingTxnID, existingTxn := range vh.activeTransactions {
if existingTxn.TheirUser == evt.Sender && existingTxn.TheirDevice == verificationRequest.FromDevice {
if existingTxn.TheirUser == evt.Sender && existingTxn.TheirDevice == verificationRequest.FromDevice && existingTxnID != verificationRequest.TransactionID {
vh.cancelVerificationTxn(ctx, existingTxn, event.VerificationCancelCodeUnexpectedMessage, "received multiple verification requests from the same device")
vh.cancelVerificationTxn(ctx, newTxn, event.VerificationCancelCodeUnexpectedMessage, "received multiple verification requests from the same device")
delete(vh.activeTransactions, existingTxnID)