From 74f52af9d5e03a02683f90f5958469d336582662 Mon Sep 17 00:00:00 2001 From: noot <36753753+noot@users.noreply.github.com> Date: Tue, 25 Apr 2023 18:30:51 +0200 Subject: [PATCH] fix: handle RPC server panic if port is in use (#418) --- bootnode/bootnode.go | 3 +++ daemon/swap_daemon.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/bootnode/bootnode.go b/bootnode/bootnode.go index 2e46fb36..1b3b0e10 100644 --- a/bootnode/bootnode.go +++ b/bootnode/bootnode.go @@ -70,6 +70,9 @@ func RunBootnode(ctx context.Context, cfg *Config) error { }, IsBootnodeOnly: true, }) + if err != nil { + return err + } log.Infof("starting bootnode with data-dir %s", cfg.DataDir) err = rpcServer.Start() diff --git a/daemon/swap_daemon.go b/daemon/swap_daemon.go index e948b89a..d3ce04ae 100644 --- a/daemon/swap_daemon.go +++ b/daemon/swap_daemon.go @@ -157,6 +157,9 @@ func RunSwapDaemon(ctx context.Context, conf *SwapdConfig) (err error) { RecoveryDB: sdb.RecoveryDB(), Namespaces: rpc.AllNamespaces(), }) + if err != nil { + return err + } log.Infof("starting swapd with data-dir %s", conf.EnvConf.DataDir) err = rpcServer.Start()