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:
parent
1f8a3d3f5a
commit
e732000d31
|
@ -3282,14 +3282,14 @@ func (m *Messenger) handleSyncKeypair(message *protobuf.SyncKeypair, fromLocalPa
|
||||||
}
|
}
|
||||||
} else if !fromLocalPairing && dbKeypair != nil {
|
} else if !fromLocalPairing && dbKeypair != nil {
|
||||||
for _, dbAcc := range dbKeypair.Accounts {
|
for _, dbAcc := range dbKeypair.Accounts {
|
||||||
found := false
|
removeAcc := false
|
||||||
for _, acc := range kp.Accounts {
|
for _, acc := range kp.Accounts {
|
||||||
if dbAcc.Address == acc.Address {
|
if dbAcc.Address == acc.Address && acc.Removed && !dbAcc.Removed {
|
||||||
found = true
|
removeAcc = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !found {
|
if removeAcc {
|
||||||
err = m.deleteKeystoreFileForAddress(dbAcc.Address)
|
err = m.deleteKeystoreFileForAddress(dbAcc.Address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue