node: fix nil reference in evm watcher (#1758)

This commit is contained in:
bruce-riley 2022-10-19 10:20:46 -05:00 committed by GitHub
parent 206d10cacf
commit c31776c345
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -254,12 +254,12 @@ func (w *Watcher) Run(ctx context.Context) error {
// will keep running. Other connectors will use a timeout internally if appropriate.
messageC := make(chan *ethabi.AbiLogMessagePublished, 2)
messageSub, err := w.ethConn.WatchLogMessagePublished(ctx, messageC)
defer messageSub.Unsubscribe()
if err != nil {
ethConnectionErrors.WithLabelValues(w.networkName, "subscribe_error").Inc()
p2p.DefaultRegistry.AddErrorCount(w.chainID, 1)
return fmt.Errorf("failed to subscribe to message publication events: %w", err)
}
defer messageSub.Unsubscribe()
// Fetch initial guardian set
if err := w.fetchAndUpdateGuardianSet(logger, ctx, w.ethConn); err != nil {