diff --git a/pkg/messaging-discovery/client/client.go b/pkg/messaging-discovery/client/client.go index 72d644ae0b..fd063c9974 100644 --- a/pkg/messaging-discovery/client/client.go +++ b/pkg/messaging-discovery/client/client.go @@ -121,12 +121,12 @@ func (c *httpClient) UpdateEntry(ctx context.Context, sk cipher.SecKey, e *Entry e.Sequence++ e.Timestamp = time.Now().UnixNano() - err := e.Sign(sk) - if err != nil { - return err - } for { + err := e.Sign(sk) + if err != nil { + return err + } err = c.SetEntry(ctx, e) if err == nil { return nil @@ -144,10 +144,6 @@ func (c *httpClient) UpdateEntry(ctx context.Context, sk cipher.SecKey, e *Entry return nil } e.Sequence = rE.Sequence + 1 - err := e.Sign(sk) - if err != nil { - return err - } } } diff --git a/pkg/messaging-discovery/client/testing.go b/pkg/messaging-discovery/client/testing.go index 5c4ca288e6..e9327dee6c 100644 --- a/pkg/messaging-discovery/client/testing.go +++ b/pkg/messaging-discovery/client/testing.go @@ -86,12 +86,12 @@ func (m *mockClient) SetEntry(ctx context.Context, e *Entry) error { func (m *mockClient) UpdateEntry(ctx context.Context, sk cipher.SecKey, e *Entry) error { e.Sequence++ e.Timestamp = time.Now().UnixNano() - err := e.Sign(sk) - if err != nil { - return err - } for { + err := e.Sign(sk) + if err != nil { + return err + } err = m.SetEntry(ctx, e) if err == nil { return nil @@ -109,10 +109,6 @@ func (m *mockClient) UpdateEntry(ctx context.Context, sk cipher.SecKey, e *Entry return nil } e.Sequence = rE.Sequence + 1 - err := e.Sign(sk) - if err != nil { - return err - } } }