Skip to content

Commit 81bad32

Browse files
committed
prevent rekeying wrong contact
1 parent faa9650 commit 81bad32

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
@@ -902,6 +902,10 @@ bool BaseChatMesh::removeContact(ContactInfo& contact) {
902902

903903
removeSessionKey(contact.id.pub_key); // also remove session key if any
904904

905+
// adjust pending rekey index before shifting array
906+
if (_pending_rekey_idx == idx) _pending_rekey_idx = -1;
907+
else if (_pending_rekey_idx > idx) _pending_rekey_idx--;
908+
905909
// remove from contacts array and parallel nonce tracking
906910
num_contacts--;
907911
while (idx < num_contacts) {

0 commit comments

Comments
 (0)