fix: a proper clock set when dispatching saved addresses
This commit is contained in:
parent
e9ff0fbefe
commit
598d58f0d6
|
@ -72,7 +72,7 @@ func (m *Messenger) syncNewSavedAddress(ctx context.Context, savedAddress *walle
|
|||
Address: savedAddress.Address.Bytes(),
|
||||
Name: savedAddress.Name,
|
||||
Removed: savedAddress.Removed,
|
||||
UpdateClock: savedAddress.UpdateClock,
|
||||
UpdateClock: updateClock,
|
||||
ChainShortNames: savedAddress.ChainShortNames,
|
||||
Ens: savedAddress.ENSName,
|
||||
IsTest: savedAddress.IsTest,
|
||||
|
@ -110,7 +110,7 @@ func (m *Messenger) HandleSyncSavedAddress(state *ReceivedMessageState, syncMess
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
state.Response.AddSavedAddress(&wallet.SavedAddress{Address: address, ENSName: syncMessage.Ens, IsTest: syncMessage.IsTest})
|
||||
state.Response.AddSavedAddress(&wallet.SavedAddress{Address: address, ENSName: syncMessage.Ens, IsTest: syncMessage.IsTest, Removed: true})
|
||||
} else {
|
||||
sa := wallet.SavedAddress{
|
||||
Address: address,
|
||||
|
|
|
@ -280,7 +280,6 @@ func (s *MessengerSyncSavedAddressesSuite) testSyncDeletesOfSavedAddressesWithTe
|
|||
|
||||
savedAddresses, err = s.other.savedAddressesManager.GetSavedAddresses()
|
||||
s.Require().NoError(err)
|
||||
s.Require().Equal(1, len(savedAddresses))
|
||||
s.Require().True(haveSameElements([]wallet.SavedAddress{sa2}, savedAddresses, savedAddressDataIsEqual))
|
||||
|
||||
// Delete saved addresses with test mode = false and sync with the other device
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
)
|
||||
|
||||
type savedAddressMeta struct {
|
||||
Removed bool
|
||||
UpdateClock uint64 // wall clock used to deconflict concurrent updates
|
||||
}
|
||||
|
||||
|
@ -24,6 +23,7 @@ type SavedAddress struct {
|
|||
ColorID multiAccCommon.CustomizationColor `json:"colorId"`
|
||||
IsTest bool `json:"isTest"`
|
||||
CreatedAt int64 `json:"createdAt"`
|
||||
Removed bool `json:"removed"`
|
||||
savedAddressMeta
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,6 @@ func TestSavedAddressesMetadata(t *testing.T) {
|
|||
Address: common.Address{1},
|
||||
Name: "Raw",
|
||||
savedAddressMeta: savedAddressMeta{
|
||||
Removed: false,
|
||||
UpdateClock: 234,
|
||||
},
|
||||
ChainShortNames: "eth:arb:",
|
||||
|
@ -212,8 +211,8 @@ func TestSavedAddressesCleanSoftDeletes(t *testing.T) {
|
|||
Address: common.Address{byte(i)},
|
||||
Name: "Test" + strconv.Itoa(i),
|
||||
ColorID: multiAccCommon.CustomizationColorGreen,
|
||||
Removed: true,
|
||||
savedAddressMeta: savedAddressMeta{
|
||||
Removed: true,
|
||||
UpdateClock: uint64(firstTimestamp + i),
|
||||
},
|
||||
}
|
||||
|
@ -245,9 +244,7 @@ func TestSavedAddressesGet(t *testing.T) {
|
|||
ENSName: "test.ens.eth",
|
||||
ColorID: multiAccCommon.CustomizationColorGreen,
|
||||
IsTest: false,
|
||||
savedAddressMeta: savedAddressMeta{
|
||||
Removed: true,
|
||||
},
|
||||
Removed: true,
|
||||
}
|
||||
|
||||
err := manager.upsertSavedAddress(sa, nil)
|
||||
|
|
Loading…
Reference in New Issue