From 7b0a6b9155feb4a28780963a4f342123ed53432c Mon Sep 17 00:00:00 2001 From: joshemb <josh@elixxir.io> Date: Wed, 10 Aug 2022 14:54:48 -0700 Subject: [PATCH] Fix minor stylistic MR comments --- dummy/random.go | 7 +------ dummy/send.go | 9 ++++----- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/dummy/random.go b/dummy/random.go index a70eb72af..4190336b5 100644 --- a/dummy/random.go +++ b/dummy/random.go @@ -48,7 +48,6 @@ func (m *Manager) newRandomCmixMessage(rng csprng.Source) ( errors.Errorf(recipientRngErr, err) } - // todo: use error constants above? // Generate random message payload payloadSize := m.store.GetCmixGroup().GetP().ByteLen() payload, err = newRandomPayload(payloadSize, rng) @@ -124,7 +123,7 @@ func newRandomMAC(rng csprng.Source) ([]byte, error) { } ////////////////////////////////////////////////////////////////////////////////// -// Random Duration functions +// Miscellaneous ////////////////////////////////////////////////////////////////////////////////// // randomDuration returns a duration that is the base duration plus or minus a @@ -141,10 +140,6 @@ func randomDuration(base, randomRange time.Duration, rng csprng.Source) ( return base + randomRange - time.Duration(delta), nil } -////////////////////////////////////////////////////////////////////////////////// -// Miscellaneous -////////////////////////////////////////////////////////////////////////////////// - // randomInt returns, as an int, a non-negative, non-zero random number in [1, n) // from the csprng.Source. func randomInt(n int, rng csprng.Source) (int, error) { diff --git a/dummy/send.go b/dummy/send.go index 8dc698bc1..06561c941 100644 --- a/dummy/send.go +++ b/dummy/send.go @@ -101,7 +101,8 @@ func (m *Manager) sendMessages() error { err = m.sendMessage(localIndex, totalMessages, rng) if err != nil { - jww.ERROR.Printf(err.Error()) + jww.ERROR.Printf("Failed to send message %d/%d: %+v", + localIndex, numMessages, err) } // Add to counter of successful sends atomic.AddInt64(&sent, 1) @@ -119,16 +120,14 @@ func (m *Manager) sendMessage(index, totalMessages int, rng csprng.Source) error // Generate message data recipient, fp, service, payload, mac, err := m.newRandomCmixMessage(rng) if err != nil { - return errors.Errorf("Failed to create dummy message %d/%d: %+v", - index, totalMessages, err) + return errors.Errorf("Failed to create random data: %+v", err) } // Send message p := cmix.GetDefaultCMIXParams() _, _, err = m.net.Send(recipient, fp, service, payload, mac, p) if err != nil { - return errors.Errorf("Failed to send dummy message %d/%d: %+v", - index, totalMessages, err) + return errors.Errorf("Failed to send message: %+v", err) } return nil -- GitLab