You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1017 B

7 years ago
7 years ago
7 years ago
7 years ago
  1. package main
  2. import (
  3. "flag"
  4. "os"
  5. cmn "github.com/tendermint/tmlibs/common"
  6. "github.com/tendermint/tmlibs/log"
  7. priv_val "github.com/tendermint/tendermint/types/priv_validator"
  8. )
  9. func main() {
  10. var (
  11. chainID = flag.String("chain-id", "mychain", "chain id")
  12. listenAddr = flag.String("laddr", ":46659", "Validator listen address (0.0.0.0:0 means any interface, any port")
  13. maxConn = flag.Int("clients", 3, "maximum of concurrent connections")
  14. privValPath = flag.String("priv", "", "priv val file path")
  15. logger = log.NewTMLogger(log.NewSyncWriter(os.Stdout)).With("module", "priv_val")
  16. )
  17. flag.Parse()
  18. logger.Info(
  19. "Starting private validator",
  20. "chainID", *chainID,
  21. "listenAddr", *listenAddr,
  22. "maxConn", *maxConn,
  23. "privPath", *privValPath,
  24. )
  25. privVal := priv_val.LoadPrivValidatorJSON(*privValPath)
  26. pvss := priv_val.NewPrivValidatorSocketServer(
  27. logger,
  28. *chainID,
  29. *listenAddr,
  30. *maxConn,
  31. privVal,
  32. nil,
  33. )
  34. pvss.Start()
  35. cmn.TrapSignal(func() {
  36. pvss.Stop()
  37. })
  38. }