node/pkg/ethereum: restart watcher if guardian set update fails (#1010)

This commit is contained in:
Leopold Schabel 2022-04-11 21:07:19 +02:00 committed by GitHub
parent d68232c447
commit 97aedff9f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -183,6 +183,8 @@ func (e *Watcher) Run(ctx context.Context) error {
return fmt.Errorf("failed to request guardian set: %v", err)
}
errC := make(chan error)
// Poll for guardian set.
go func() {
t := time.NewTicker(15 * time.Second)
@ -193,8 +195,8 @@ func (e *Watcher) Run(ctx context.Context) error {
return
case <-t.C:
if err := e.fetchAndUpdateGuardianSet(logger, ctx, caller); err != nil {
logger.Error("failed updating guardian set",
zap.Error(err), zap.String("eth_network", e.networkName))
errC <- fmt.Errorf("failed to request guardian set: %v", err)
return
}
}
}
@ -287,7 +289,6 @@ func (e *Watcher) Run(ctx context.Context) error {
}
}()
errC := make(chan error)
go func() {
for {
select {