fix: remove account if it's marked as removed in received `protobuf.SyncKeypair` message

When we switched to marking removed accounts, the handler remained unchanged. It kept
checking for the account existence in the received `protobuf.SyncKeypair` message, instead
of checking a removed flag.
This commit is contained in:
Sale Djenic 2023-08-22 11:30:26 +02:00 committed by saledjenic
parent 1f8a3d3f5a
commit e732000d31
1 changed files with 4 additions and 4 deletions

View File

@ -3282,14 +3282,14 @@ func (m *Messenger) handleSyncKeypair(message *protobuf.SyncKeypair, fromLocalPa
}
} else if !fromLocalPairing && dbKeypair != nil {
for _, dbAcc := range dbKeypair.Accounts {
found := false
removeAcc := false
for _, acc := range kp.Accounts {
if dbAcc.Address == acc.Address {
found = true
if dbAcc.Address == acc.Address && acc.Removed && !dbAcc.Removed {
removeAcc = true
break
}
}
if !found {
if removeAcc {
err = m.deleteKeystoreFileForAddress(dbAcc.Address)
if err != nil {
return nil, err