diff --git a/main.go b/main.go index 85c9f67..02fafbd 100644 --- a/main.go +++ b/main.go @@ -103,6 +103,10 @@ func nodeMain() { // load keystore ks := crypto.NewLuxKeyStore(config.KeyStore) + if err := ks.Load(); err != nil { + fmt.Fprintf(os.Stderr, "failed to laod keystore: %v\n", err) + os.Exit(1) + } nodeKey, ok := ks.Get(nodeId) if !ok { @@ -175,16 +179,20 @@ func nodeMain() { sigs := make(chan os.Signal, 1) signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) +signaling: for { sig := <-sigs + fmt.Println(sig) switch sig { case syscall.SIGINT: + break signaling case syscall.SIGTERM: - // stop node daemon - node.Stop() - os.Exit(0) + break signaling } } + + // stop daemon + node.Stop() } func main() {