Skip to content

Commit 6c0a87e

Browse files
committed
prevent rekeying wrong contact
1 parent 606ff36 commit 6c0a87e

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/helpers/BaseChatMesh.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,10 @@ bool BaseChatMesh::removeContact(ContactInfo& contact) {
969969

970970
removeSessionKey(contact.id.pub_key); // also remove session key if any
971971

972+
// adjust pending rekey index before shifting array
973+
if (_pending_rekey_idx == idx) _pending_rekey_idx = -1;
974+
else if (_pending_rekey_idx > idx) _pending_rekey_idx--;
975+
972976
// remove from contacts array and parallel nonce tracking
973977
num_contacts--;
974978
while (idx < num_contacts) {

0 commit comments

Comments
 (0)