Skip to content

Commit

Permalink
feat(relayer): only publish messages with new status (#16351)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Mar 8, 2024
1 parent 1bdae7c commit 88c39d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/relayer/indexer/handle_message_sent_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ func (i *Indexer) handleMessageSentEvent(
return errors.Wrap(err, "svc.eventStatusFromMsgHash")
}

// only add messages with new status to queue
if eventStatus != relayer.EventStatusNew {
slog.Info("event status is not new, skipping")
return nil
}

marshaled, err := json.Marshal(event)
if err != nil {
return errors.Wrap(err, "json.Marshal(event)")
Expand Down
5 changes: 4 additions & 1 deletion packages/relayer/watchdog/watchdog.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ func InitFromConfig(ctx context.Context, w *Watchdog, cfg *Config) error {

watchdogAddr := crypto.PubkeyToAddress(*publicKeyECDSA)

var q queue.Queue
q, err := cfg.OpenQueueFunc()
if err != nil {
return err
}

w.eventRepo = eventRepository
w.suspendedTxRepo = suspendedTxRepo
Expand Down

0 comments on commit 88c39d8

Please sign in to comment.