diff --git a/client/client_test.go b/client/client_test.go index 3182809220088cf2f6713cbfa127081237e99af2..9073f4754ef2c2375892a521965bae09692793e6 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -93,7 +93,7 @@ func TestSignAndTransmit(t *testing.T) { Port: "11420", }, mapImpl) if err != nil { - t.Errorf("Failed to start dummy server") + t.Errorf("Failed to start dummy server: %+v", err) errChan <- err } else { doneChan <- true diff --git a/cmd/server.go b/cmd/server.go index 04d599b52ed8a6d9671b2b9faac16192ed150746..f4c1bbf3a450ee4aee6354f508fbec0b89de58d5 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -90,6 +90,9 @@ var serverCmd = &cobra.Command{ } err = server.StartServer(params, s) + if err != nil { + jww.FATAL.Fatalf("Failed to start server: %+v", err) + } var stopCh = make(chan bool) select { case <-stopCh: diff --git a/server/serverImpl.go b/server/serverImpl.go index f41d3c7c58c8a832613a8a871ba55c39fa91e869..215b1dfb219fcd7747e6cf79c86c63f1439f689d 100644 --- a/server/serverImpl.go +++ b/server/serverImpl.go @@ -52,19 +52,21 @@ func StartServer(params Params, s *storage.Storage) error { } // Attempt to load in list of node IDs exempt from duplicate wallet checking - if p, err := pathutils.ExpandPath(params.IDListPath); err == nil { - idList, err := pathutils.ReadFile(p) - if err != nil { - return errors.WithMessage(err, "Failed to read ID list path") - } - r := csv.NewReader(bytes.NewReader(idList)) - records, err := r.ReadAll() - for _, r := range records { - nid := r[0] - impl.idList[nid] = true + if params.IDListPath != "" { + if p, err := pathutils.ExpandPath(params.IDListPath); err == nil { + idList, err := pathutils.ReadFile(p) + if err != nil { + return errors.WithMessage(err, "Failed to read ID list path") + } + r := csv.NewReader(bytes.NewReader(idList)) + records, err := r.ReadAll() + for _, r := range records { + nid := r[0] + impl.idList[nid] = true + } + } else { + return errors.WithMessage(err, "Failed to expand ID list path") } - } else { - return errors.WithMessage(err, "Failed to expand ID list path") } // Build gin server, link to verify code @@ -97,7 +99,9 @@ func StartServer(params Params, s *storage.Storage) error { c.JSON(http.StatusAccepted, newCommitment) }) impl.comms = r + // Run with TLS + jww.INFO.Print("Starting commitments server...") if params.KeyPath == "" && params.CertPath == "" { jww.WARN.Println("NO TLS CONFIGURED") return r.Run(fmt.Sprintf("0.0.0.0:%s", params.Port))