Skip to content

Commit 545169e

Browse files
committed
prevent rekeying wrong contact
1 parent c1deffa commit 545169e

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

994994
removeSessionKey(contact.id.pub_key); // also remove session key if any
995995

996+
// adjust pending rekey index before shifting array
997+
if (_pending_rekey_idx == idx) _pending_rekey_idx = -1;
998+
else if (_pending_rekey_idx > idx) _pending_rekey_idx--;
999+
9961000
// remove from contacts array and parallel nonce tracking
9971001
num_contacts--;
9981002
while (idx < num_contacts) {

0 commit comments

Comments
 (0)