From d31716434556a5140a15bd5484cbb910243ca422 Mon Sep 17 00:00:00 2001 From: Leo Date: Fri, 21 Aug 2020 11:17:55 +0200 Subject: [PATCH] Rename ethwatch to ethlockup and run it in a runnable group with the watcher This ensures that we re-fetch the guardian set when ethlockup dies. --- bridge/cmd/guardiand/{ethwatch.go => ethlockup.go} | 0 bridge/cmd/guardiand/main.go | 13 ++++++------- 2 files changed, 6 insertions(+), 7 deletions(-) rename bridge/cmd/guardiand/{ethwatch.go => ethlockup.go} (100%) diff --git a/bridge/cmd/guardiand/ethwatch.go b/bridge/cmd/guardiand/ethlockup.go similarity index 100% rename from bridge/cmd/guardiand/ethwatch.go rename to bridge/cmd/guardiand/ethlockup.go diff --git a/bridge/cmd/guardiand/main.go b/bridge/cmd/guardiand/main.go index 8106baf0..85d310f1 100644 --- a/bridge/cmd/guardiand/main.go +++ b/bridge/cmd/guardiand/main.go @@ -202,19 +202,18 @@ func main() { return err } - if err := supervisor.Run(ctx, "eth", - ethereum.NewEthBridgeWatcher(*ethRPC, ethContractAddr, *ethConfirmations, lockC, setC).Run); err != nil { - return err - } + // We need to re-fetch the initial initiator set when ethwatch dies, so we want to restart the watcher as well. + // TODO: on-demand fetching of guardian set to avoid restarting ethwatch? + supervisor.RunGroup(ctx, map[string]supervisor.Runnable{ + "ethwatch": ethereum.NewEthBridgeWatcher(*ethRPC, ethContractAddr, *ethConfirmations, lockC, setC).Run, + "ethlockup": ethLockupProcessor(lockC, setC, gk, sendC, ethObsvC, vaaC), + }) if err := supervisor.Run(ctx, "solana", solana.NewSolanaBridgeWatcher(*agentRPC, lockC, vaaC).Run); err != nil { return err } - if err := supervisor.Run(ctx, "ethwatch", ethLockupProcessor(lockC, setC, gk, sendC, ethObsvC, vaaC)); err != nil { - return err - } logger.Info("Started internal services") supervisor.Signal(ctx, supervisor.SignalHealthy)