chore: remove unused `applicationLayer` parameter of `HandleMessages`

This commit is contained in:
Patryk Osmaczko 2023-07-04 22:53:53 +02:00 committed by osmaczko
parent 67050429df
commit 2613064356
3 changed files with 9 additions and 11 deletions

View File

@ -647,7 +647,7 @@ func unwrapDatasyncMessage(m *v1protocol.StatusMessage, datasync *datasync.DataS
// layer message, or in case of Raw methods, the processing stops at the layer // layer message, or in case of Raw methods, the processing stops at the layer
// before. // before.
// It returns an error only if the processing of required steps failed. // It returns an error only if the processing of required steps failed.
func (s *MessageSender) HandleMessages(shhMessage *types.Message, applicationLayer bool) ([]*v1protocol.StatusMessage, [][]byte, error) { func (s *MessageSender) HandleMessages(shhMessage *types.Message) ([]*v1protocol.StatusMessage, [][]byte, error) {
logger := s.logger.With(zap.String("site", "handleMessages")) logger := s.logger.With(zap.String("site", "handleMessages"))
hlogger := logger.With(zap.ByteString("hash", shhMessage.Hash)) hlogger := logger.With(zap.ByteString("hash", shhMessage.Hash))
var statusMessage v1protocol.StatusMessage var statusMessage v1protocol.StatusMessage
@ -715,11 +715,9 @@ func (s *MessageSender) HandleMessages(shhMessage *types.Message, applicationLay
hlogger.Error("failed to handle application metadata layer message", zap.Error(err)) hlogger.Error("failed to handle application metadata layer message", zap.Error(err))
} }
if applicationLayer { err = statusMessage.HandleApplication()
err = statusMessage.HandleApplication() if err != nil {
if err != nil { hlogger.Error("failed to handle application layer message", zap.Error(err))
hlogger.Error("failed to handle application layer message", zap.Error(err))
}
} }
} }

View File

@ -114,7 +114,7 @@ func (s *MessageSenderSuite) TestHandleDecodedMessagesWrapped() {
message.Sig = crypto.FromECDSAPub(&relayerKey.PublicKey) message.Sig = crypto.FromECDSAPub(&relayerKey.PublicKey)
message.Payload = wrappedPayload message.Payload = wrappedPayload
decodedMessages, _, err := s.sender.HandleMessages(message, true) decodedMessages, _, err := s.sender.HandleMessages(message)
s.Require().NoError(err) s.Require().NoError(err)
s.Require().Equal(1, len(decodedMessages)) s.Require().Equal(1, len(decodedMessages))
@ -150,7 +150,7 @@ func (s *MessageSenderSuite) TestHandleDecodedMessagesDatasync() {
message.Sig = crypto.FromECDSAPub(&relayerKey.PublicKey) message.Sig = crypto.FromECDSAPub(&relayerKey.PublicKey)
message.Payload = marshalledDataSyncMessage message.Payload = marshalledDataSyncMessage
decodedMessages, _, err := s.sender.HandleMessages(message, true) decodedMessages, _, err := s.sender.HandleMessages(message)
s.Require().NoError(err) s.Require().NoError(err)
// We send two messages, the unwrapped one will be attributed to the relayer, while the wrapped one will be attributed to the author // We send two messages, the unwrapped one will be attributed to the relayer, while the wrapped one will be attributed to the author
@ -214,7 +214,7 @@ func (s *MessageSenderSuite) TestHandleDecodedMessagesDatasyncEncrypted() {
message.Sig = crypto.FromECDSAPub(&relayerKey.PublicKey) message.Sig = crypto.FromECDSAPub(&relayerKey.PublicKey)
message.Payload = encryptedPayload message.Payload = encryptedPayload
decodedMessages, _, err := s.sender.HandleMessages(message, true) decodedMessages, _, err := s.sender.HandleMessages(message)
s.Require().NoError(err) s.Require().NoError(err)
// We send two messages, the unwrapped one will be attributed to the relayer, // We send two messages, the unwrapped one will be attributed to the relayer,

View File

@ -3248,7 +3248,7 @@ func (m *Messenger) handleImportedMessages(messagesToHandle map[transport.Filter
for filter, messages := range messagesToHandle { for filter, messages := range messagesToHandle {
for _, shhMessage := range messages { for _, shhMessage := range messages {
statusMessages, _, err := m.sender.HandleMessages(shhMessage, true) statusMessages, _, err := m.sender.HandleMessages(shhMessage)
if err != nil { if err != nil {
logger.Info("failed to decode messages", zap.Error(err)) logger.Info("failed to decode messages", zap.Error(err))
continue continue
@ -3397,7 +3397,7 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
} }
} }
statusMessages, acks, err := m.sender.HandleMessages(shhMessage, true) statusMessages, acks, err := m.sender.HandleMessages(shhMessage)
if err != nil { if err != nil {
logger.Info("failed to decode messages", zap.Error(err)) logger.Info("failed to decode messages", zap.Error(err))
continue continue